Lab 03. Cleaning App

From Introduction to Robotics (CS460)
Jump to: navigation, search

Lab 03. Cleaning application with Turtlesim

Lab Objectives

The objective of this lab is to practice on the control of mobile concepts in ROS and localization in 2D space by developing a ROS node that a turtlesim behaves like a roomba cleaning robot. Follow the three first tutorials in Gaitech EDU Tutorial on Turtlesim Cleaning Application.

  • Lecture 4: Introducing the Cleaning Application
  • Lecture 5: Moving in a Straight Line


The total lecture time of the two lectures is around 20 minutes.

You task will be to understand the concept of the code in ROS C++ and write the same in Python.

The videos

  • Lecture 4: Go to Goal

  • Lecture 5: Grid/Spiral Cleaning Applications (Turtlesim Cleaner)


Testing the program on your machine (OPTIONAL - CAN BE SKIPPED)

It is easy to first test the execution of the program on your machine.

Compilation

First, you need to compile the code written in C++. You will go through all the hassle of compiling and executing a C++ in ROS. If you are not that curious, and do not have time, skip this testing step.

The process is explained in the video, but you can follow these steps:

  • In a terminal, write:
roscd gaitech_edu/

This will take you to the gaitech_edu directory.

  • Then open CMakeLists.txt to edit as follows:
gedit CMakeLists.txt
  • Then, add these two lines at the very end of the file CMakeLists.txt
add_executable(cleaning_node src/turtlesim/cleaning_app/robot_cleaner.cpp)
target_link_libraries(cleaning_node ${catkin_LIBRARIES})

Pay attention not to make any random modification of that file, otherwise, it will not compile.

  • Then, close the CMakeLists.txt file, and close the terminal.
  • Open another terminal and write:
cd catkin_ws
  • Then, compile using the command:
catkin_make

wait until the program is compiled and if all is fine you will as at the end something like

...
[ 98%] Built target ardronelib
[100%] Built target ardrone_driver
Linking CXX executable /home/ros/catkin_ws/devel/lib/gaitech_edu/cleaning_node
[100%] Built target cleaning_node

NOTE: In case of any problem in compilation here, send me an email and I will send you the correct CMakeLists.txt file to work with.

Testing

Now, after compilation you can run as follow: In a first terminal, start roscore:

roscore

In a second terminal, start turtlesim simulator as follows:

rosrun turtlesim turtlesim_node

In a third terminal, start the cleaning application already written in c++ and also compiled as follows:

 rosrun gaitech_edu cleaning_node

You will see the Turtlesim moving as in the video. Now, this testing step is DONE.

Your Task

Review Questions

  • What are the steps followed to develop the cleaning application?
  • Explain how the Twist message is used to make the robot move straight and rotate?
  • What is the equation used to make the robot move in spiral form? How this implemented in ROS?
  • What is the drawback of method used to control the traveled distance and rotated angle? Explain and justify your claim.
  • What is the equation used to implement a P-Controller for the go to goal location. Explain the principle.
  • In your python code, try several values of the PID gain Kp for both linear and angular velocity, and observe the impact. What is the best value found?

Do-It-Yourself=

You are requested to extend the cleaning application by making it smarter. We want to program the robot such that it moves 1 meter, then rotates 360 degrees in place, and repeat the process until the area is cleaned.

  • You need to start for the left-bottom place first, then
  • You need to use a loop to control the robot motion until the end of the mission.

Your program should providing a testing of all these functions with a menu.

Deadline

This task must be submitted on Monday at 4:00 pm, by email.

Grading

Will be considered an assignment of Programming Assignments (20%). See Grading