Gazebo | Ignition | Community
Ask Your Question
0

Setting acceleration of object using plugins

asked 2014-10-21 11:21:11 -0500

Sunil gravatar image

updated 2014-10-21 11:23:17 -0500

Hi,

I was going through the Gazebo model plugin tutorials (http://gazebosim.org/tutorials?tut=pluginsmodel&ver=1.9%2B&cat=writeplugin). I was successfully able to set velocity of the object and make it move.

However,without changing anything else, instead of using SetLinearVel, when I used SetLinearAccel, the box did not move at all.

This is the relevant section of my code (all I did was to replace SetLinearVel in the Original code with SetLinearAccel)

public: void OnUpdate(const common::UpdateInfo & /*_info*/)
{
  // Apply a linear acceleration to the model.

  this->model->SetLinearAccel(math::Vector3(1,0,0));
  printf("Acceleration Set\n"); //Just to see whether the function is working (and it did print it)
}

Please help me figure out what the problem is.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-12-07 10:01:05 -0500

nkoenig gravatar image

The SetLinearAccel function will not cause the model to move. It only sets the linear acceleration attribute on each Link.

This is because Gazebo would have to do the conversion from acceleration to velocity outside of the standard physics update loop, and we haven't implemented that yet.

Here is a related issue in our tracker.

edit flag offensive delete link more

Comments

it is deprecated in gazebo 11 what is the equivalent one ?

tam abdou gravatar imagetam abdou ( 2021-12-21 09:16:04 -0500 )edit
0

answered 2014-11-12 19:21:40 -0500

NickDP gravatar image

I haven't actually tried this myself, but it reminds me of a problem I had when I tried going from setting joint velocities as in the tutorial you mentioned to setting joint forces/torques.

The joint's wouldn't move until I figured out that I had to use SetMaxForce() with some non-zero value for the maximum force for every joint I wanted to apply a force to.

I hope this either solves your problem or gives you some direction to keep looking.

edit flag offensive delete link more

Comments

Thanks Nick. I'll try it out.

Sunil gravatar imageSunil ( 2014-12-02 05:17:18 -0500 )edit

Hey, We were able to make the object move by using the function AddForce on the link. We used a link pointer to get the link of the box and using AddForce, the object was moved. In the SDF, we put 100 N as the MaxForce for the box but SetLinearAccel was still not able to move accelerate the object.

Sunil gravatar imageSunil ( 2014-12-02 08:43:57 -0500 )edit

I had same problem, any one?

Kei Okada gravatar imageKei Okada ( 2015-12-07 05:51:53 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-10-21 11:21:11 -0500

Seen: 1,938 times

Last updated: Dec 07 '15