SetPosition target problem
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
joints) - bottom -> right_wheel (continuous
joints)
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 jointsrightarm_ 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.
Asked by Brosseau.F on 2016-03-16 09:26:19 UTC
Answers
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.
Asked by nkoenig on 2016-03-16 09:36:16 UTC
Comments
Ok, thank you. I will check my code.
Asked by Brosseau.F on 2016-03-16 09:52:41 UTC
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.
Asked by Brosseau.F on 2016-03-16 12:31:24 UTC
I have cleaned my build folder and made some changes in the inertia and it's working now.
Thanks for the help.
Asked by Brosseau.F on 2016-03-31 11:00:12 UTC
Comments
I'm unfamiliar with
gazebo_ros
and thegetJoint
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.Asked by nkoenig on 2016-03-16 12:21:26 UTC
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.
Asked by Brosseau.F on 2016-03-17 04:54:10 UTC
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.
Asked by nkoenig on 2016-03-17 10:06:13 UTC
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.
Asked by Brosseau.F on 2016-03-17 11:39:16 UTC