ECE 550: Advanced Robotic Planning
Programming Homework #2

Due: March 17, 2016.

For the assignment, you will implement an artificial potential field path planner, and use it to plan paths for a Kuka youbot robot in a polygonal world. The lab has three parts: setting up Gazebo and the Kuka youbot simulator, setting up a world model (including obstacles), finding collision-free paths using a potential field planner.

As for the last programming assignment, Hyongju (your course TA) has prepared a tutorial for Assignment #2 to guide you through the assignment. The tutorial contains information for a variety of options (for example, guidelines for both hydro and indigo ROS distributions), as well as launch files.

Part 1: Setting up Gazebo and the Youbot simulator

In the first programming assignment, you used the turtlesim package to simulate a simple (and adorable) turtlebot. The main advantage of turtlesim is its simplicity. The robot kinematics are trivial and the interface code is straightforward. Real robots, however, are significantly more complex in their geometric structure, and realistic simulation requires the ability to model not only geometry, but also dynamics. In short, while turtlesim is a fine vehicle for introducing ROS programming, it is not appropriate for realistic robotics applications. Therefore, in this assignment we introduce the Gazebo simulator, and use it to simulate the Kuka youbot.

Happiliy, Gazebo is installed by default on full ROS installations. You can easily verify that Gazebo is installed (after running roscore) using the command:

$ roslaunch gazebo_ros empty_world.launch

Unfortunately, the Youbot package is typically not included in the default ROS distribution. Therefore, you'll need to install this yourself. You'll find step-by-step instructions in Hyongju's tutorial for both hydro and indigo ROS distributions.

For the first programming assignment, it was fairly straightforward to launch your ROS programs using simple shell commands. For this assignment, there are quite a few things that need to be done when firing up the Gazebo Youbot simulator, and doing so by typing shell commands (each time you want to debug your code) quickly becomes tedious.. Happily, ROS provides an easy way to launch multiple programs by using launch files. Again, Hyongju has taken care of you by providing a sample launch file in his tutorial.

Once you have installed the Youbot simulator and created (or modified) an appropriate launch file, you should write some test code, to ensure that you know how to write code to interact with the Youbot simulator.

Part 2: Setting up a world model

Path planning isn't very interesting in an obstacle-free environment. For this assignment, we'll use URDF (Unified Robot Description Format) files to define the geometry of robots and of obstacles. There are various ways to create URDF models, but for this assignment, Hyongju's tutorial includes URDF files for a simple world that can be used to test and demonstrate your programs. If you wish to design your own environments, you can create your own URDF files by hand, or you can use a tool such as the Solidworks along with its URDF exporter (which requires a bit of learning effort).

The launch file provided in Hyongju's tutorial also loads the simple_world URDF file.

Part 3: A potential field planner

Now that you can simulate a Youbot in an environment that contains simple obstacles, you are to write a program that implements some version of the potential fields planner that was described in the lecture. For this assignment, we will consider the Youbot to be a polygonal robot that translates and rotates in the plane (i.e., we will ignore the arm for this assignment).

You should assign a few control points to the Youbot (say, at the corners of the rectangular base), and use these control points to compute both attractive and repulsive forces. To compute the repulsive force for the i-th control point, it will be necessary to identify the point in the obstacle boundary that is nearest to this control point. For this assignment, since we are are considering motion planning in the plane, you can treat the obstacles as polygons in the plane. Thus, you will need to write code that identifies the point in the boundary of a polygon that is nearest to a given control point. You must use the Jacobian of the forward kinematics to map the gradients of the workspace forces to generalized configuration space forces.

Although writing the code for this project should not be overly difficult, you should spend some time plotting the approach that you will take. What data abstractions will you use? What functions will you need to write? What publisher or subscriber functions will you need in order to execute your path plan on the Youbot? Here are a few pointers to start your thinking:

  • This project requires motion planning in the plane. Thus, even though the robot and obstacles are 3D objects, you need only consider their projections onto the plane, which means that you may treat both the Youbot and the obstacles as polygons.
  • Since you'll be doing lots of work with polygons, it would be a good idea to design an appropriate C++ class to represent polygons. You'll need to save at least (a) a list of vertices, (b) the number of vertices.
  • Rather than write code to read obstacle information from the URDF file, it's fine to hard code the obstacle polygons in your program (at least for this assignment).
  • You'll need to compute the distance between a control point and a polygon (for each obstacle polygon). Write modular code to do this. First write code to compute the distance from a point to a line that that is defined by two vertices, along with the closest point on the line. Then use this result to determine the distance from the point to the line segment. Do this for each edge of the polygon, and the edge with smallest distance is the closest edge.
  • In the C++ class for your planar polygonal robot, you can associate member functions with each vertex that return the Jacobian for the vertex given a configuration. If you do this and keep things general and modular, it will be trivial to define other polygonal robots with varying numbers of control points.

    What to turn in: For this assignment, you are required to give a live demonstration to the course TA. Scheduling for this will be arranged closer to the due date.