Start core ROS processes
- Start roscore
- Start rxgraph
Make a robot teleop process
cd ~/ros_workspace git clone http://www.cse.unsw.edu.au/~cs3431/teleop_twist_keyboard.git cd teleop_twist_keyboard rosmake
(That is a local cache of code available here: http://brown-ros-pkg.googlecode.com/.)
Start a Simulation
rosrun stage stageros `rospack find stage`/world/willow-erratic.world
Note this is using one of the simulated worlds that comes with ROS. Details on the ROS integration of stage are on the ros wiki: http://www.ros.org/wiki/stage. That page lists the ROS topics published and subscribed to. The
.world file describes the world to simulate.
Start a visualisation: (the simulation is showing us the 'real world' - this visualisation will show us what the robot's sensors see.)
rosrun rviz rviz
note that you cannot see anything. I am assuming in these notes that you last started rvis using the config file
/opt/ros/diamondback/stacks/laser_drivers/sicktoolbox_wrapper/sick_test.vcg. If not, then use the file menu to open that config.
The robot's laser and the simulation's laser have slightly different names.
In global options, change the
Fixed frame and
Target frame each from
/base_laser_link. In the laser scan section, change the
/base_scan. Remember from the tutorials that ROS allows you to rename things on the command line. We could also have copied and edited the
sick_test.vcg config file.
You should now see the laser scan in rviz.
Drive the simulated robot around using the keyboard and look at what the simulated laser sees.
Look at the rxgraph output and note that the
teleop_twist_keyboard node is publishing commands on the
/cmd_vel topic the same way the joystick was last week. (If someone wants to write a better keyboard teleop, that would be cool.)
You can also use
rostopic echo /base_scan to see the simulated laser output.
Making your own world
Look at the stage documentation for world files at http://playerstage.sourceforge.net/doc/Stage-3.2.1/group__model__position.html. Build your own simple world with a couple of circular pillars of different sizes and a robot with a laser on it. The example world files that come with stage are also useful (e.g the
/opt/ros/diamondback/stacks/simulator_stage/stage/world/willow-erratic.world file used above). Note that an object's shape is specified by a bitmap. A bitmap of a circle is available at http://www.cse.unsw.edu.au/~cs3431/Circle.png.
Drive around your world.