(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Adapting RCommander to Your Robot

Description: Guides you to creating an instance of RCommander for your robot.

Tutorial Level: INTERMEDIATE

Next Tutorial: Creating New States Editor in RCommander

Why create an RCommander environment for your robot?

Creating an RCommander interface for your robot allows you to use the functionalities of SMACH in a visual environment enabling faster prototyping of robot behaviors. An RCommander interface will allow you to more easily create, tune, save, and reload your robot behavior for future use.

What does this involve?

An RCommander environment consists of three primary components: a Python file that calls on the main RCommander GUI, a set of plugin files that provide the graphical interface and SMACH nodes for each of your robot action, and (optionally) a shared object that gets passed to each of your SMACH node during execution. In this tutorial, we'll cover the first step and the others in tutorials following.

Setting up an RCommander environment

First create a package for your RCommander files:

roscreate-pkg my_rcommander rospy rcommander
mkdir -p my_rcommander/src/my_rcommander/

Next, in a text editor create a new executable Python script at my_rcommander/src/my_rcommander/my_rcommander.py :

   1 #!/usr/bin/python
   2 import roslib; roslib.load_manifest('my_rcommander')
   3 import rcommander.rcommander as rc
   4 import rospy
   5 
   6 rospy.init_node('my_rcommander', anonymous=True)
   7 rc.run_rcommander(['default'])

In the above source file, the first three lines import the needed ROS and RCommander libraries. Next, we initialize our program as a ROS node then the last call launch RCommander with the set of plugins called default (the next tutorial will show you how to make your own plugins).

Make this file executable with:

chmod u+x my_rcommander/src/my_rcommander/my_rcommander.py

Now run the newly created script:

./my_rcommander/src/my_rcommander/my_rcommander.py

An RCommander instance should popup:

plain_rcommander.png

This is a fully featured instance of RCommander but it doesn't have very many useful actions yet except for the State Machine, Sleep, and Trigger tool. To really customize it for our robot we'll need to create custom GUIs for each of our action in the next tutorial: Creating New States Editor in RCommander

Wiki: rcommander_core/tutorials/Adapting RCommander to Your Robot (last edited 2012-04-16 16:48:31 by HaiDNguyen)