RIG InMoov Project
Simulation

Table of Contents

The simulation for the RIGbot runs in ROS. It accepts commands in the same protocol described in index.Arduino. You must first use git to download the project, detailed in Introduction.

This section only details basic usage and slight modification. For the information required to add any new features, model modifications, or bug fixes, you may need to read the beginner level ROS tutorials and the urdf tutorials.

Dependencies

The simulation depends on ROS. We use the Jade version, as it is the long term release. It is recommended you install the full system because of the number of the large number of ROS packages. On Ubuntu, this is achieved with the following commands.

1 sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
2 sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-key 0xB01FA116
3 sudo apt-get update
4 sudo apt-get install ros-jade-desktop-full

If you experience problems, please read the full wiki article.

Building

To build the simulation, simply run the following from the root directory of the project.

1 make simulation

You may also want to build manually. Before running any ROS commands, you must run this command.

1 source /opt/ros/jade/setup.bash

There are also .zsh and .sh files for users of zsh or sh. It is recommended you append this command to your shell's .rc file (ex. ~/.bashrc). Make sure to fill in the absolute path to rig-inmoov/catkin-ws.

The following only needs to be run once.

1 cd catkin_ws/src
2 catkin_init_workspace

Finally, we can build the project.

1 cd catkin_ws
2 catkin_make

Usage

After running all the necessary setup commands, you can finally run the simulation.

1 roslaunch robot_description display.launch port:=/dev/ttyACM0

This requires that an input board such as the flex sensor glove is connected. Replace "port" with the port your desired board is connected on (search for the naming convention for your board online). The output from launch commands is captured in ~/.ros/log/.

You can also set and change the port later with the following command.

1 rosparam set /serial_publisher/port /path/to/port

The serial publisher does not need to be running.

If the serial publisher crashes because it loses connection, you can re-launch it with this command without ending the visualizer.

1 rosrun robot_description serial_publisher

Background

We have two custom programs used to maintain the simulation. The first is serial_publisher, compiled from catkin_ws/src/robot_description/src/serial_publisher.cpp. This program accepts input from a serial port and translates it to a ROS topic.

The other program is state_publisher, compiled from state_publisher.cpp in the same directory. This program listens to the topic and translates it into joint positions, which rviz (the visualizer component of ROS) listens to. It expects input of the same protocol as described in Introduction.

The modularity of these programs makes it easy to write publishers for new protocols (such as bluetooth) using just serial_publisher.cpp as reference. It also makes it easy to add new parts to state_publisher. New programs need to be added to catkin_ws/src/robot_description/CMakeLists.txt.

The rviz visualizer is loaded with a urdf file, stored in catkin_ws/src/robot_description/model.xml, that describes how the different 3D models that make up movable parts are positionally related to one another.

Debugging

There are two example launch files used for debugging, stored in catkin_ws/src/robot_description/launch along with display.launch. The first is debug.launch, which launches state_publisher and serial_publisher in gdb, and the second, memdebug.launch, launches both programs in Valgrind. It is recommended that you use the three launch files as reference when modifying and creating program systems.