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
- Installation and set-up: Setup STDR Simulator
- Basics, read tutorials and practice to learn how to:
- Open STDR server, the GUI visualizer
- Load a build-in/external map to server (see cheat sheet for instruction)
- Load robots using the given xml file
- Create robots using GUI (demo in class)
- 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.
- Learn to publish and subscribe to topics either via terminal commands or running python scripts to control the STDR robots
- 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.
Screenshots to prove that you know how to use roslaunch to, called shotN.png
- launch the STDR server and GUI with no map (note, no GUI is displayed!)
- launch the STDR server and GUI with the built-in map robocup
- launch the STDR server and GUI with a map and a robot (one default command)
- launch the STDR server and GUI, register with this external map
- 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
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
- Use terminal to echo the values of the LIDAR. Submit a screenshot to prove it works.
- Publish a Twist message to make the robot move/turn/stop in STDR
- 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
Write a python script, which should be able to achieve the following goals:
The robot will go straight forward
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.)
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.
- 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.
- The final test will be EITHER clockwise OR counterclockwise. So please do NOT hard-code your turning. Submission:
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