Robot Control and Using tf in ROS Solution



The objective of this assignment is to get started with robot simulation in ROS, and use tf to relate the coordinate system of one robot with the other.

Before you get started, please make sure you have done the following:

Complete ROS tutorials 1 through 12 (in Section 1.1 Beginner) and be able to write a simple publisher and subscriber in ROS

Simulation Setup

In this section, you will learn about launch les. Create a package named lab1 that depends on std msgs rospy roscpp. Download the world and launch les for this as-signment from here. It contains three les – and playground.pgm which together form the initial stage world, and lab1.launch that is the initial launch le.

Please read the roslaunch tutorial to understand the roslaunch le. Drop the world les and the launch les in the appropriate sub-directories in the new package. Test to see if you can launch stage using the launch le by running the command

$ roslaunch lab1 lab1.launch


You might need to re-run the path commands after creating the package for roslaunch to identify the new package lab1.

You don’t need to run roscore when you use roslaunch. However, you do need to have roscore running when you use rosrun

Evader Controller

In this section, you will write your own controller. Familiarize yourself with the given robot by checking the information it publishes and subscribes. The robot also has a laser range nder attached to it. Move the robot by dragging it with your mouse pointer to face a wall. Monitor the output of the laser by using rostopic echo in the command line. You should be able to understand the output of the sensor from the stage world le and its output you observed.

Write a controller node that drives the robot straight at a constant speed of 2m/s. When the robot is close to an obstacle, the robot should stop, turn in a random new direction, and drive at the same speed. Create a new launch le evader.launch that adds the execution of this node to what was in the earlier launch le.


Read through the tf tutorial. Publish the coordinate frame of the robot wrt the global frame. Create a new world le with a second robot called pursuer, and drop it into the world close to the rst robot. Write a controller node for the pursuer that subscribes to the tf messages from the evader, and follows the evader by going to the spot it was at from one second before. Create a third launch le pursuer-evader.launch to run the new world with the two robots, the evader controller, and the pursuer controller as separate nodes.

Submission Instructions

You will submit lab1.tar.gz, a compressed archive le containing the lab1 folder. The folder should contain the two world les and the pgm le in an appropriate sub-folder, two launch les evader.launch and pursuer-evader.launch in an appropriate sub-folder, and two controllers – one for the evader and another for the pursuer in an appropriate sub-folder. The folder should compile if I drop it into my catkin workspace and call catkin make. Please take care to follow the instructions carefully so we can script our tests, and not have to dig into each submission. Problems in running will result in loss of points.

Please use the submit script for submission using the syntax

$ submit cse468 lab1.tar.gz


$ submit cse568 lab1.tar.gz

depending on whether you are taking cse468 or cse568 respectively.

Details on the usage of the submit script can be found here.