Started:SettingControllers

From OpenRAVE

Jump to: navigation, search

In order for openrave to control certain robot hardware, a Controller has to be created that will interface with the hardware-specific libraries. This controller interface then has to be created through the Environment and set onto an existing robot.

Assuming that there exists a plugin with a controller interface named MyController, here are some ways to set an openrave robot to use it:

  • XML - add a <controller> tag in the openrave robot XML file like this:
    <robot file="robots/schunk-lwa3.robot.xml">
    
    <controller type="MyController" args="controller arguments here"></controller>
    </robot>
    • It is also possible to set a controller outside of the robot definition by specifying the robot's name. For example:
    <environment>
    
    <robot name="schunk-lwa3" file="robots/schunk-lwa3.robot.xml">
    </robot>
    <controller type="MyController" robot="schunk-lwa3" args="controller arguments here"></controller>
    </environment>
  • C++
RobotBasePtr probot = GetEnv()->GetRobot("schunk-lwa3");
ControllerBasePtr pcontroller = GetEnv()->CreateController("MyController");
probot->SetController(pcontroller,"trajectoryservice /controller_session joints j0 j1 j2 j3 j4 j5 j6");
  • Python
robot = env.GetRobot('schunk-lwa3')
controller = env.CreateController('MyController')
robot.SetController(controller,'controller arguments here')
  • Octave/MATLAB
robotid = orEnvGetBody('schunk-lwa3');
orRobotControllerSet(robotid,'MyController','controller arguments here')
Personal tools