How to turn a revolute joint in a C++ script

RogerInHawaii
Collaborator

How to turn a revolute joint in a C++ script

RogerInHawaii
Collaborator
Collaborator

I've got a a joint that I've picked up from a JointsList...

Ptr<Joint> ThisJoint = JointsList->item(0);

 

and I do know that it's a revolute joint, although I only know that because I also check the NAME that I gave to it. So my first question is how can I determine the actual "type" of joint from my ThisJoint object.

But more importantly, once I have hold of the revolute joint,how do I, using a C++ script, cause the joint to actually rotate? What method do I call? And do I have to call something extra in order to get the image to update so I can actually SEE the rotation occurring?

0 Likes
Reply
299 Views
1 Reply
Reply (1)

Anonymous
Not applicable

-> see Learning page  RevoluteJointMotion API Sample

 

Here is some condensed code with the key points:

 

Ptr<RevoluteJointMotion> motion = joint->jointMotion(); 
// jointMotion() is property of Joint
// RevoluteJointMotion is a derived class from JointMotion
	
JointTypes type = motion->jointType(); 
// JointTypes => ENUM for type => if you just want to find out the type (first part of your question) 

			
bool isOk = motion->rotationValue(1.57);	// change angle 

 

2 Likes