ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

plugin in gazebo

asked 2012-10-17 21:26:19 -0500

Nachum gravatar image

Hi I am trying to make a plugin in gazebo to control a 1 joint urdf model. I am able to give it tourque by this command -

 this->only_joint_->SetForce(0,(-10*(this->only_joint_->GetAngle(0)));

but if i try giving a different command like-

this->only_joint_->SetForce(0,(-3*this->only_joint_->GetVelocity(0)+10*(this->only_joint_->GetAngle(0)));

it isn't willing to compile. any idea?

Thanks Nachum

edit retag flag offensive close merge delete

Comments

For questions like this, it is very helpful if you add the actual error message you encounter. (You can edit your post to do that)

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2012-10-17 21:46:25 -0500 )edit

GetAngle(0) returns a gazebo::math::Angle object, you need to invoke the GetAngle().GetAsRadian() member function as you did in your own answer below.

hsu gravatar image hsu  ( 2012-10-18 05:11:52 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-10-18 00:03:18 -0500

Nachum gravatar image

O.k I just put it in 2 different lines and it works nicely.

this->only_joint_->SetForce(0,-2*this->only_joint_->GetAngle(0).GetAsRadian());
 this->only_joint_->SetForce(0,-2*this->only_joint_->GetVelocity(0));
edit flag offensive delete link more

Comments

for what do i need the zero in GetAngle(0)?

Nachum gravatar image Nachum  ( 2012-10-18 00:04:13 -0500 )edit

for some joints such as Hinge2Joint and Universal joints, there are two states per joint.

hsu gravatar image hsu  ( 2012-10-18 05:08:11 -0500 )edit

what are the two states?

Nachum gravatar image Nachum  ( 2012-10-20 22:33:18 -0500 )edit

Question Tools

Stats

Asked: 2012-10-17 21:26:19 -0500

Seen: 381 times

Last updated: Oct 18 '12