From OpenRAVE
Jump to: navigation, search

Code Examples

Setting A Robots Manipulators To Default

<source lang="cpp"> baseManip = RaveCreateModule(penv, "BaseManipulation"); if(baseManip == NULL) { ROS_FATAL("Was unable to create module BaseManipulation. Check your $OPENRAVE_PLUGINS\n"); return false; } penv->AddModule(baseManip, myRobot->GetName()); //Move our manipulators to default positions so they don't fall with physics... stringstream sinput, soutput; for(vector<RobotBase::ManipulatorPtr>::const_iterator myIt = myRobot->GetManipulators().begin(); myIt != myRobot->GetManipulators().end(); myIt++) { sinput.clear(); sinput.str(""); sinput << "MoveManipulator goal"; for(unsigned int i = 0; i < (*myIt)->GetArmIndices().size(); i++) sinput << " 0";

myRobot->SetActiveManipulator((*myIt)->GetName()); baseManip->SendCommand(soutput, sinput); } </source>