Robotics StackExchange | Archived questions

Setting acceleration of object using plugins

Hi,

I was going through the Gazebo model plugin tutorials (http://gazebosim.org/tutorials?tut=plugins_model&ver=1.9%2B&cat=write_plugin). 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.

Asked by Sunil on 2014-10-21 11:21:11 UTC

Comments

Answers

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.

Asked by NickDP on 2014-11-12 20:21:40 UTC

Comments

Thanks Nick. I'll try it out.

Asked by Sunil on 2014-12-02 06:17:18 UTC

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.

Asked by Sunil on 2014-12-02 09:43:57 UTC

I had same problem, any one?

Asked by Kei Okada on 2015-12-07 06:51:53 UTC

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.

Asked by nkoenig on 2015-12-07 11:01:05 UTC

Comments

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

Asked by tam abdou on 2021-12-21 10:16:04 UTC