Gazebo | Ignition | Community
Ask Your Question

SetPosition target problem [closed]

asked 2016-03-16 09:26:19 -0500

Brosseau.F gravatar image

updated 2016-03-29 10:37:59 -0500

Hello everybody,

I want to move a link of my robot using SetPosition.

I have several joints :

  • body -> left_arm (prismatic joints)
  • body -> right_arm (prismatic joints)
  • body -> bottom (fixed joints)
  • bottom -> left_wheel (continuous
  • bottom -> right_wheel (continuous

I have made some changes in the same diff drive plugin. The continuous joints with SetParam("vel",...) work fine. But when I do a SetPosition on an arm joint, the value is also sent to the wheel joints.

Is there a simple way to move a link on a prismatic joint with a model plugin ?

Update :

How I get the joints in Load function :

 joints_.resize ( 2 );
joints_[LEFT] = gazebo_ros_->getJoint ( parent, "leftJoint", "left_joint" );
joints_[RIGHT] = gazebo_ros_->getJoint ( parent, "rightJoint", "right_joint" );
joints_right_arm_ = gazebo_ros_->getJoint ( parent, "rightArmJoint", "body_right_arm_prismatic" );

with joints a vector of physics::JointPtr and joints_right_arm_ a physics::JointPtr.

How i send command :

joints_[LEFT]->SetParam("vel", 0, wheel_speed_[LEFT]/ ( wheel_diameter_ / 2.0 ));
joints_[RIGHT]->SetParam("vel", 0, wheel_speed_[RIGHT]/ ( wheel_diameter_ / 2.0 ));
joints_right_arm_->SetPosition( 0, right_arm_pos_);

Update 2:

I still have this problem. When I comment SetPosition (arm not controlled) wheels can reach a speed of 2m/s. When SetPosition is not commented, wheels only reach a position of 0.6 m/s.

I have seen on other posts that a high effort on a joint can be transmitted to another links. So I tried to play with damping params but without success.

I also tried to tune fmax param but without success. Is there other parameters that I had to set to make the wheels respect the sent velocity ?

Thanks in advance.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Brosseau.F
close date 2016-03-31 11:00:52.467592


I'm unfamiliar with `gazebo_ros` and the `getJoint` function. Can you try using Gazebo functions in your plugin? If you have model plugin, you should have a pointer to the model, from which you can access the model's joints.

nkoenig gravatar imagenkoenig ( 2016-03-16 12:21:26 -0500 )edit

I tried using GetJoint from the Gazebo functions on all the joint that I am trying to control but I still have the same problem.

Brosseau.F gravatar imageBrosseau.F ( 2016-03-17 04:54:10 -0500 )edit

Take a careful look at all of your code, including the methods you are using to run everything. It's *extremely* unlikely that there is a bug in Gazebo where commanding one joint erroneously moves a different joint. You could also post all your code, and someone might have time to debug it.

nkoenig gravatar imagenkoenig ( 2016-03-17 10:06:13 -0500 )edit

I finally make it work. I use SetPositionTarget of JointController Class. And I have removed SetEffortLimit and SetVelocityLimit from the prismatic joint. Thanks for the help.

Brosseau.F gravatar imageBrosseau.F ( 2016-03-17 11:39:16 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-03-31 11:00:12 -0500

Brosseau.F gravatar image

I have cleaned my build folder and made some changes in the inertia and it's working now.

Thanks for the help.

edit flag offensive delete link more

answered 2016-03-16 09:36:16 -0500

nkoenig gravatar image

The Joint::SetPosition function should only affect one joint, not two different joints. I imagine you have a bug in your code if you're seeing two different joints move.

edit flag offensive delete link more


Ok, thank you. I will check my code.

Brosseau.F gravatar imageBrosseau.F ( 2016-03-16 09:52:41 -0500 )edit

I have created a new plugin to control arms but I have the same problem. When I comment a plugin the other works fine. I will try to change SetPosition with a set position using pid controller.

Brosseau.F gravatar imageBrosseau.F ( 2016-03-16 12:31:24 -0500 )edit

Question Tools

1 follower


Asked: 2016-03-16 09:26:19 -0500

Seen: 2,170 times

Last updated: Mar 31 '16