Objectives

In this assignment, you will create a PID controller to demonstrate your knowledge of controls. A ROS package, controls_hw, has been provided in the course folder of your repository. This package contains code to run vehicle dynamics code and display a graph of the results. You do NOT have to write your own code for dynamics or graphing. Your code needs to subscribe to the relevant topics provided by the dynamics node and publish a control signal to the dynamics node.

The controller is expected to stop a simulated vehicle (think of it as a fairly large truck) that starts at 20 m/s within 30m. Note that this is slightly different from the lecture examples but the same basic problem. To do this:

  1. Create a new package to hold your PID code for this assignment and Lab 4.
  2. Create a ROS node to implement the PID controller. It is recommended (but not required) to create a PID controller class that can be reused in Lab 4. This is best done by creating a separate Python file containing only the PID class, which is instantiated by your ROS node for this homework and Lab 4.
  3. Experiment with gain values until your system stops at the 30m line. To receive full credit:
    1. It should stop at the desired position within 15 seconds.
    2. It should not overshoot by more than 1m.
    3. It should end within 2m of the desired position.
  4. Create a ROS launch file that starts all code needed for this solution.

Given ROS Package

The ROS package, controls_hw, has been provided for you in the class template repo in the EECE5560 folder. You should not need to modify this package. The package contains:

  1. vehicle_dynamics.py: A ROS node that simulates a large vehicle, like a truck, moving at an initial speed of 20 m/s and expecting to stop in 30m. A few notes:
    1. The dynamics simulator waits for a param, “controller_ready” to be set to “true” before it will start. If it ends on its own, it will reset this param to “false”. If you stop the program early it may not reset the param. Note that this is a string “true” not a boolean.
    2. The dynamics simulator runs for 30 seconds before stopping. Feel free to change the code if you would like it to run longer or shorter.
    3. The dynamics simulator expects a std_msgs Float32 message on “control_input”. This should be the desired acceleration from the controller in m/s^2.
    4. The dynamics simulator publishes several topics, but the most useful one for a controller is “error”, a std_msgs Float32 message giving desired – actual position in meters.
  2. controls_graphy.py: A ROS node to graph the desired position, actual position, and actual velocity of the vehicle.
  3. start_dynamics.launch: A launch file that starts the vehicle dynamics node and the graphing node.

Submission Instructions

Turn in to Blackboard:

  1. The URL for your git repo
  2. The git tag for this submission
  3. The name of the package you created
  4. The roslaunch command that starts your solution
  5. The graph generated by your code (screenshot is ok) (4 points)
  6. A brief description of how you tuned the system. How did you select what numbers to try? (4 points)
  7. What were the final values for your PID gains? (2 point)

Rubric

4 points: Submission details (Q1-4 above)
10 points: Answers to Q5-7 above
6 points: PID controller package and launch file
10 points: PID controller node
10 points: accuracy – overshoot less than 1m and stops within 2m of 30m mark in 15 seconds