How to set rotation axis for Hinge Joint in Gazebo created from source? [closed]

asked 2012-06-18 02:01:53 -0600

Andrei Haidu gravatar image

updated 2014-01-28 17:12:42 -0600

ngrennan gravatar image

Hi there,

I am creating dynamically a Hinge Joint between two bodies via a controller in Gazebo (with ROS electric). The bodies belong to the same model. The Joint gets created, its upper and lower angle limit work fine, the problem is that I cannot set the rotation axis for it.

The code looks something like this:

Vector3 anchorPos3,rotAxis3;

Joint *j;

j = World::Instance()->GetPhysicsEngine()->CreateJoint(gazebo::Joint::HINGE);

j->body1 = dynamic_cast<body*>(this->sphereBodies[body1_indice]);

j->body2 = dynamic_cast<body*>(this->sphereBodies[body2_indice]);

j->anchorBody = j->body1;

j->SetAttribute(gazebo::Joint::HI_STOP,0,0.5);

j->SetAttribute(gazebo::Joint::LO_STOP,0,-0.5);

//next two functions don't work as expected, after I call j->GetAxis(0) and j->GetAnchor(0) , both positions are 0, 0, 0;

j->SetAxis(0, rotAxis3); // NOT WORKING

j->anchorPos = anchorPos3; // NOT WORKING

j->Attach(j->body1, j->body2);

Thanks, Andrei

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by tfoote
close date 2015-03-03 01:55:25.328788

Comments

Please ask gazebo questions at http://answers.gazebosim.org

tfoote gravatar image tfoote  ( 2015-03-03 01:55:16 -0600 )edit