Shape Drawing

From Introduction to Robotics (CS460)
Jump to: navigation, search
Lab 01: Shape Drawing

Lab Objectives

The objective of this lab is develop a ROS node that makes the turtlesim draws a particular shape. The lab aims at consolidating the student's understanding on publishing and subscribing to topics and also processing ROS messages to accomplish the mission of the robot.

Setting-Up the Source File from GitHub

First, you need to download the lab_exam catkin ROS package from GitHub. GitHub is a popular Web-based Git repository hosting service. It offers all of the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.
The lab_exam contains the file shape_drawing.cpp that you will need to edit. Follow these steps to clone the lab_exam package into your catkin workspace:

  • In a terminal, go to the source folder of your catkin workspace ~/catkin_ws/src
  • In ~/catkin_ws/src, write this command git clone https://github.com/aniskoubaa/lab_exams
  • check that the folder is cloned (downloaded from the GitHub repository) using the ls command
  • Use Eclipse and open the whole catkin workspace
  • In lab_exam folder, go to CMakeList.txt and uncomment the two lines that compile the drawing_shape.cpp. This is very important, otherwise, the file will not be compiled.
  • Once done, go to ~/catkin_ws/ and compile with catkin_make

Make sure that the compilation is performed with no error.
The next step is to edit the drawing_shape.cpp as requested in the tasks below.
Note that the file is commented and placed where to add the code are well indicated inside the file

Tasks

Task 1: Letter Drawing

In the first task, your program requests the user to select a choice from a pre-defined list letters which is: {'C', 'S', '4'}.
Then, the turtlesim draws the corresponding letter. We consider one unit as the distance traveled by the turtlesim with a linear speed equal to 1.0 for 1.0 second. Make a function for each letter drawing.
After you finish drawing, your program must:

  • display the time spent in drawing the letter using ROS_INFO.
  • publish a std_msgs/String message on the topic /object_drawn that contains the letter drawn.
  • display the pose of the robot using ROS_INFO

Task 2: Shape Drawing

In this task, the user is requested to select a particular shape to draw, which is selected from the list {'square', 'triangle', 'circle'}
It also requests the user to enter the dimension of the shape in units, where a unit is the distance traveled by the turtlesim with a linear speed equal to 1.0 for 1.0 second.
The turtlesim then draws the shape of interest.
Your program must return the time spent in drawing the shape.
Make a function for each shape drawing.
After you finish drawing, your program must:

  • display the time spent in drawing the let shape using ROS_INFO.
  • publish a std_msgs/String message on the topic /object_drawn that contains the shape drawn.
  • display the pose of the robot using ROS_INFO

What to Submit

  • The shape_drawing.cpp file that contains your code for the ROS node.
    • A launch file that launches both turtlesim_node, and the shape_drawing_node.
    • Pictures showing the letters and shapes as drawn by your turtlesim.

How to Submit

You must submit the lab_exam package in your personal shared dropbox folder. Put the submitted package into a newly created folder with name lab01
Make sure that your the last version cpp code and launch file are included.
Also, in lab01/pictures/ put all pictures of the letters and shapes as drawn by the turtlesim.

Grading

  • Grade: 10 points
  • Bonus: The best robot shape drawer will get 1 extra point. The performance is evaluated in terms
    • Goodness of the shape/letter
    • Time spent to draw the shape and the letter.
  • Deadline:
    • Task 1: Monday October 05, 2015
    • Task 2: Saturday October 10, 2015