How to set rotation axis for Hinge Joint in Gazebo created from source? [closed]
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
Please ask gazebo questions at http://answers.gazebosim.org