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 and 15 seconds. After 15 seconds, the desired position will change to 60 meters (think of a truck stopped at a stop sign, then moving to the next stop sign) within the next 15 seconds. 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.
  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 the system stops at the 30m line. To receive full credit:
    1. It should stop at each 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. You should be able to find ONE set of gains that can accomplish this.
  4. The system should then move to and stop at the 60m line in the same way.
  5. Create a ROS launch file that starts all code needed for this solution.
  6. Update the HW9 launcher script to start your launch file.

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 at 30m then at 60m. A few notes:
    1. The dynamics simulator waits for a param, “controller_ready” to be set to “ready” 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.
    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

Complete the qualtrics survey with answers to the questions.

Turn in to Blackboard the graph generated by your code (screenshot is ok) (4 points) and your code from Qualtrics.

Rubric

8 points: Submission details
8 points: Answers to questions
4 points: PID controller package and launch file
10 points: PID controller node
5 points: accuracy – overshoot less than 1m and stops within 2m of 30m mark in 15 seconds
5 points: accuracy – overshoot less than 1m and stops within 2m of 60m mark in 30 seconds