int main() { RaveInitialize(false, OpenRAVE::Level_Debug); env = RaveCreateEnvironment(); env->StopSimulation(); // bool success = env->Load("data/pr2test2.env.xml"); { bool success = env->Load("/home/joschu/Proj/drc/gfe.xml"); FAIL_IF_FALSE(success); } { bool success = env->Load("/home/joschu/Proj/trajopt/data/test2.env.xml"); FAIL_IF_FALSE(success); } vector<RobotBasePtr> robots; env->GetRobots(robots); RobotBasePtr robot = robots[0]; vector<RobotBase::ManipulatorPtr> manips = robot->GetManipulators(); cc = CollisionChecker::GetOrCreate(*env); viewer.reset(new OSGViewer(env)); env->AddViewer(viewer); ManipulatorControl mc(manips[manips.size()-1], viewer); DriveControl dc(robot, viewer); StatePrinter sp(robot); viewer->AddKeyCallback('a', boost::bind(&StatePrinter::PrintAll, &sp)); viewer->AddKeyCallback('q', &PlotCollisionGeometry); viewer->AddKeyCallback('=', boost::bind(&AdjustTransparency, .05)); viewer->AddKeyCallback('-', boost::bind(&AdjustTransparency, -.05)); viewer->Idle(); env.reset(); viewer.reset(); RaveDestroy(); }
DriveControl::DriveControl(OpenRAVE::RobotBasePtr robot, OSGViewerPtr viewer) : m_robot(robot), m_viewer(viewer) { viewer->AddKeyCallback(osgGA::GUIEventAdapter::KEY_Left, boost::bind(&DriveControl::MoveRobot, this, 0,.05, 0)); viewer->AddKeyCallback(osgGA::GUIEventAdapter::KEY_Right, boost::bind(&DriveControl::MoveRobot,this, 0,-.05, 0)); viewer->AddKeyCallback(osgGA::GUIEventAdapter::KEY_Up, boost::bind(&DriveControl::MoveRobot, this,.05,0, 0)); viewer->AddKeyCallback(osgGA::GUIEventAdapter::KEY_Down, boost::bind(&DriveControl::MoveRobot, this,-.05,0, 0)); viewer->AddKeyCallback(osgGA::GUIEventAdapter::KEY_Leftbracket, boost::bind(&DriveControl::MoveRobot, this,0,0, .05)); viewer->AddKeyCallback(osgGA::GUIEventAdapter::KEY_Rightbracket, boost::bind(&DriveControl::MoveRobot, this,0,0, -.05)); }