From irlab
Jump to: navigation, search

General information about ROS can be found at the ROS website.


Installing ROS

Instructions for installation can be found at the installation page.

ROS Java

To allow the current rosjava run framework to use a classpath beyond the precompiled rosjava.jar file, I made the following changes to my rosjava install.

Edited the run script using:

rosed rosjava run

and changed the exec line to be the following:

exec java -classpath $ROS_CLASSPATH:`rospack find rosjava`/dist/rosjava.jar org.ros.RosRun $@

I then added this to the end of ~/ros/

export ROS_CLASSPATH=/Users/nah/Documents/workspace/ros-tutorials/bin

You should edit the above to point to where you want to save your classes for compiled ROS nodes etc.

ROS Problems


There have been problems found when attempting to follow the tutorial on simulating a robot using player and rviz.

An error may occur when running the command

rosmake teleop_base

If this happens, a possible solution is to make the command_toolbox directly from source.

First, go to the ROS root directory


Then, get the package from source with

svn co

This should download the command_toolbox package to the ROS root directory. You can now make the toolbox with

rosmake control_toolbox

Running rosmake on teleop_base should now work without any problems.

overcoming problems installing rosjava

Maven (used to install dependencies) requires to be configured to use the school's proxy if connected to one of the school networks (e.g. ccarobot). You need to create a file ~/.m2/settings.xml with the following content:


Cannot Verify OS durng rosdep

Someone find a solution to this.

ROS tips

Shutting down nodes from within ROS

To shutdown a single node, call rospy's shutdown routine from the desired node.

rospy.signal_shutdown(reason) #where 'reason' is an optional human-readable string

You can customise the behaviour of the node on shutting down by defining your own shutdown hook:

#where shutdown_func is the name of the function to be called when the node shuts down.

Shutting down ROScore from within ROS

To shutdown ROScore (i.e. all nodes and /rosout) from within ROS you need to set a node as 'required'. This is done within the <node> tag of a roslaunch file.

Roslaunch allows you to start ROScore, initialise multiple nodes and to set parameters on the ROS parameter server. A short example of the syntax is shown below:

<group ns="groupName">
<include file="$(find pkgname)/launch/filename1.launch"/>
<include file="$(find pkgname)/launch/filename2.launch"/>
<param name="gain" value="3.0" />
<node name="node1" pkg="pkgname" type=""/>
<node name="node2" pkg="pkgname" type="" required="true"/>

This file can then be launched using:

roslaunch pkgname filename.launch

This starts ROScore, launches the contents of filename1.launch and filename2.launch, defines a parameter and initialises two nodes. 'node2' is labelled as 'required' which means that calling rospy.signal_shutdown from this node will shutdown everything launched from this launch file (including ROScore itself).

More information about roslaunch files can be found here:

Note that making changes to roslaunch files will require you to rosmake the package.

Launch File for pioneer

You'll need the following stacks:

And a launch file (for roslaunch) called pioneer.launch containing:

  <node pkg="hokuyo_node" type="hokuyo_node" name="hokuyo" output="screen">

  <node pkg="p2os_driver" type="p2os" name="odom_node" output="screen">
    <param name="port" value="/dev/ttyUSB0" />

  <node pkg="tf" type="static_transform_publisher" name="stp_laser" output="screen" args="0.145 0.0 0.05 0 0 0 base_link laser 100">

You can then run the system with

roslaunch pioneer.launch

map building with B21

inspired by

  1. recording
    1. run b21 launch from roslaunch b21.launch
    2. record a bag of data: rosbag record -O mylaserdata /scan /tf /odom
    3. switch to joystick control on the B21 and joystick it around
    4. Ctrl-C everything once you have recorded enough
  2. mapping
    1. enable simulation time to map from recorded data rosparam set use_sim_time true
    2. run gmapping: rosrun gmapping slam_gmapping scan:=/scan _base_frame:=base
    3. replay the data bag: rosbag play mylaserdata.bag
    4. save the map to a file: rosrun map_server map_saver
    5. check the map and store it somehwere: eog map.pgm

See Also

ROS Commands

Personal tools