STDR (2d Multi Robot Simulator)
Homework for STDR

Intro to STDR

There are multiple different simulators in ROS. This homework uses STDR. Running simulation will let you test your code on a simulated Turtlebot before on a physical one (we don’t want to get the real one damaged!).

1: Introduction to STDR

  1. Installation and set-up: Setup STDR Simulator
  2. Basics, read tutorials and practice to learn how to:
    1. Open STDR server, the GUI visualizer
    2. Load a build-in/external map to server (see cheat sheet for instruction)
    3. Load robots using the given xml file
  3. Create robots using GUI (demo in class)
  4. Advanced
    1. Familiar with naming / topics / messages for STDR robots e.g. default topic for speed and laser sensor: ‘robot0/cmd_vel’, ‘robot0/laser_0’ * Hint: with STDR running with a spawned robot, use ‘rostopic list’, ‘rosmsg’etc.check see what’s new there? Also examine the topics, to see who is publishing/subscribing that topic, its msg types, etc.
  5. Learn to publish and subscribe to topics either via terminal commands or running python scripts to control the STDR robots
  6. Test your knowledge of how to use the STDR simulation tool at the most basic level: launch the GUI, load maps and spawn robots. Your learning in the Advanced part will be tested in the next assignment.

Tip: the first robot loaded into the map becomes robot0, the second becomes robot1, the third becomes robot2… And the number will keep increasing even though you delete the previous robot(s). Keep in mind, publishing/subscribing to /cmd_vel and /robot0/cmd_vel is DIFFERENT! Try to explore why and how are they different from each other.

Deliverable:

Screenshots to prove that you know how to use roslaunch to, called shotN.png

  1. launch the STDR server and GUI with no map (note, no GUI is displayed!)
  2. launch the STDR server and GUI with the built-in map robocup
  3. launch the STDR server and GUI with a map and a robot (one default command)
  4. launch the STDR server and GUI, register with this external map
  5. Create a custom robot on the map on the GUI. Your robot should have: 3 sonars, one in the front with a range of 30 degrees, and two on the side, each with a range of 20 degrees.

Tip: Use the launchers in the stdr_launchers folder

It should look like this when loaded into the map:

Please submit one folder named STDR containing the following files: shot1.png, shot2.png, shot3.png, shot4.png (or .jpb)

2: Sensors and motors

Preparation:
  1. Use terminal to echo the values of the LIDAR. Submit a screenshot to prove it works.
  2. Publish a Twist message to make the robot move/turn/stop in STDR
  3. Create your own robot file. Your robot should contain 3 sonars, one in the front with a range of 30 degrees, and two on the side, each with a range of 20 degrees. (Please refer to Figure 1 in Assignment 1.2) Submit your xml file named as customized.xml
Programming Assignment:

Write a python script, which should be able to achieve the following goals:

  1. The robot will go straight forward

  2. When it detects an obstacle (e.g. wall) in the front, the robot will turn back (180°) Note: there is no way to set how many degrees to turn. You need to use the Odometry (http://wiki.ros.org/navigation/Tutorials/RobotSetup/Odom) to make the U-turn (You can achieve it by calibrating the turning speed and turning time, but that is not recommended.)

  3. Improve this further by actually following a wall:

(Figure 2) Initially, the robot will go straight forward (along the solid red arrow). When it detects an obstacle (e.g. wall), it will turn to the opening. In this case, there is a wall in the front, and another one on the left, so you should turn right (as showed by the dotted red line. The robot will keep following the wall through another turn, always turning right. Eventually, the robot will walk in a square in the given situation.

NOTE
  1. You should start turning when you detect an obstacle within 0.2 meter, and maintain 0.2 meter away from the wall when you walk along it.
  2. The final test will be EITHER clockwise OR counterclockwise. So please do NOT hard-code your turning. Submission:
Deliverable

Please submit a folder named SM including the following files:

  • screenshot of LIDAR values(Preparation.1)
  • customized.xml (Preparation.3)
  • the src folder of your package