Assignment 1: Wheeled Robot Control
Part 1: KinematicsIn the first part of this assignment, you will implement models for the forward and inverse kinematics of a differential drive robot. This assignment will assume the following conventions:
Pure PythonThe heavy mathematical lifting for calculating kinematics in this assignment will be done in assignment01/src/assignment01/kinematics.py.
The first function to define is for forward kinematics.
def forward(p, a, rd): (x,y,theta) = p (vl,vr,t) = a (axle_length, wheel_radius, max_speed) = rd return 0.0, 0.0, 0.0Given a pose and an action (given as 3-tuples) and a robot description (2-tuple), return the new pose.
The second function defines inverse kinematics.
def inverse(p0, p1, rd): (x0,y0,theta0) = p0 (x1,y1,theta1) = p1 (axle_length, wheel_radius, max_speed) = rd return Given two poses and a robot description, return an array of actions that will move the robot from one pose to the other. In the simplist cases, the robot will only need a single action. However, some pose combinations will require multiple moves.
There are three possible solutions for our robot. The first is the easiest to implement, that uses three discrete actions per calculation: turn, move in a straight line, turn. The second approach is for positions that only require one move, and is just the inverse of the forward kinematics. The third approach is something that takes fewer than three moves to move anywhere.
To test the code, you are given two python scripts. assignment01/src/forward.py will call your forward kinematic function based on command line arguments and print out the resulting pose. assignment01/src/inverse.py will call your inverse kinematic function based on command line arguments, print out the resulting set of actions, and use your forward kinematic model to figure out where the plan actually ends up.
ROS PythonUsing the first half of the rospy service tutorial as a guide, write a python script in assignment01/src/services.py that creates Services for both the forward and inverse kinematics, as defined in wheeled_robot_kinematics/srv.
This code can be tested on cse550.com.
Simulation TestWith the IK service implemented, you can begin to command a robot to particular locations. To see this in action, we can run a simulated diff-drive robot in the Gazebo simulator.
Part 2: ControllersIn this part of the assignment, your goal is to program a robot to drive in an aribitrary poylgon shape. The polygon will depend on two parameters: the number of sides to the polygon, and the maximum dimension of the shape. As the number of sides increases, the length of each side decreases.
In general, the algorithm will be
In assignment01/src/assignment01/polygon.py, write two functions.
def get_side_length(sides, max_d)which return an angle a in radians and a distance d in meters for the polygon.
ROS PythonUsing the above library, write two scripts to drive in a polygon shape.
The first version of the algorithm will be open loop in assignment01/src/open_polygon.py. It will figure out what velocity it needs to move for the specified angle/distance, and drive that velocity for a set period of time.
The second version of the algorithm will have proportional control in assignment01/src/prop_polygon.py. It will use its current position to figure out its next action.
On a TurtlebotTo demonstrate that your code works, run the code on a turtlebot. A demo of this must either be recorded on video (and an uploaded link sent to the professor) or done live for the professor.