The goals of this lab are to gain experience working with PID controllers, launch files, and the ROS parameter server.
If you haven't already, run the account configuration script: ros_config_account.sh.
Accept the PID lab assignment invitation posted to Piazza. The repository page for this lab already contains the starter code that you will be using. Clone the repository into your workspace folder:
cd ~/catkin_ws/src
git clone GIT_URL pid_practice
Take a minute to read over the file guidance.py
in the scripts
directory, and the file rocket.launch
in the launch directory.
Make sure you understand the contents of those files. Build your
workspace and source ~/catkin_ws/devel/setup.bash
.
Start ROS using the roscore
command.
Launch rocket.launch
in a separate terminal:
roslaunch pid_practice rocket.launch
You can change the target altitude by clicking in the RocketBot simulator window.
Modify guidance.py
so that it reads the PID gain parameters from
the parameter server and uses the PID controller provided in
pid.py
to control the y-component of the thrust.
Use the rosparam
command line utility to set the three
parameters expected by guidance.py
to some initial values and
re-launch.
Experiment with different values for your gain parameters until you find settings that work well. The rocket should rise smoothly to the target altitude with minimal overshoot and oscillations. (I suggest resetting the PID controller when the target location changes. Otherwise the D term will experience a large transient value that could cause significant overshoot.)
Once you are satisfied with your gain parameters, modify
rocket.launch
to set the parameters appropriately. The launch
file XML format is described on
this wiki page. Test the new
launch file. Once everything is working, commit and push your
changes. Make sure all members have joined the GitHub group.
guidance.py
to handle horizontal as well as vertical
control. Your finished control node should reliably move the
rocket to whatever point the user clicks in the simulator window.