Home | Tutorials | Wiki | Issues
Ask Your Question
0

Setting joint velocity through plugin

asked 2013-05-09 05:10:17 -0600

Lothas gravatar image

I'm writing a model plugin in C++ to use with ROS+Gazebo via python (similar to AtlasPlugin) I wrote a reset function to allow me to set initial conditions for a model (world position, joints positions and velocities). Everything is working right except for the joint velocities. I'm using Joint::SetVelocity() but nothing happens. I also tried using Joint::Update() after and still nothing... Here's a small snippet of my code:

this->joints[i]->SetVelocity(0,_req.joint_vel[i]);
this->joints[i]->Update();

I'll appreciate any help :)

edit retag flag offensive close merge delete

Comments

If possible, you could use SetForce instead of SetVelocity as I think that would work.

iche033 gravatar imageiche033 ( 2013-05-10 02:19:35 -0600 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2014-02-21 16:55:57 -0600

nkoenig gravatar image

You should call SetMaxForce for the joint. This tells the physics engine the maximum force that can be applied to a joint in order to achieve the specified velocity.

edit flag offensive delete link more
2

answered 2013-05-10 11:47:06 -0600

Adolfo Rodríguez T gravatar image

What does this->joints[i]->GetMaxForce(0) return?. I stumbled into this recently, and figured that the MaxForce needs to be set to a nonzero value, ie.

this->joints[i]->SetMaxForce(0, nonzero_val)

The odd thing was that I could do this->joints[i]->SetAngle(0, angle) with the MaxForce set to zero and it worked. AFAICT the joint was not static.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2013-05-09 05:10:17 -0600

Seen: 2,927 times

Last updated: Feb 21 '14