In this lab, we'll be using the LiveGrapher real-time graphing application to display various waveforms and tune the parameters of a simulated mechanical system.
On Linux, install the following package depending on your platform.
- *buntu: qt5-default
- Arch Linux: qt5
As a preface, if your machine has 64-bit MSYS2 installed, always install the 64-bit version of packages. Otherwise, install the 32-bit versions. The versions have "x86_64" and "i686" in their names respectively.
On Windows, open an "MSYS2 MinGW 64-bit" terminal and install Qt 5 with
pacman -S mingw-w64-x86_64-qt5. The download is large, so it
may take a while to install. (We had to open a terminal different from
"MSYS2 MSYS" because Qt packages aren't provided in MSYS).
Next, clone the LiveGrapher Git repository with
git://github.com/Team3512/LiveGrapher. Follow the instructions in
README.md to build it.
Motion profile data
Note: At the moment, the test server only builds on Linux. Until this is resolved, Windows users should skip this section.
LiveGrapher uses a client-server model for data transmission. The program we just built is the LiveGrapher client application, so a server is needed to test your setup. Our test server will simulate the output of S-curve and trapezoidal motion profiles. Run the following commands in the parent directory of your LiveGrapher repository folder.
git clone git://github.com/Team3512/LiveGrapherTest cd LiveGrapherTest rm -f src/LiveGrapher && ln -s ../../LiveGrapher/host/LiveGrapher src/LiveGrapher rm -f common && ln -s ../../LiveGrapher/common common make
After the build is complete, start the server.
IPSettings.txt to use a
127.0.0.1. This instructs LiveGrapher
to look for a running server on the local machine, known as localhost. The
defaults for the other options are fine. Read the README for documentation
on the other options.
Start the client and click the "Connect" button. A dialog box should pop up with two check boxes. These correspond to two different graph datasets the server is providing. Select at least one, then click "Ok". You should see a graph start to scroll by. The axes will automatically scale to fit the data the graph contains. To view the other dataset, click the "Connect" button and choose different checkboxes from the dialog.
DC brushed motor simulation
Our robotics team mainly uses LiveGrapher to display the state of mechanical subsystems of our robots in real-time so we can tune their response. This part will walk you through tuning the feedback controller for a simulated DC brushed motor.
Main.cpp in LiveGrapherTest with this file, rebuild the project, and rerun the server.
After reconnecting LiveGrapher, two datasets will be available: "Reference"
and "Velocity". Graph both of them.
In robotics, we use feedback controllers to make motors track a desired
reference signal. Your goal is to make the motor's rotational velocity
track the reference shown on the graph. Do this by modifying the PID
DCMotor.cpp, rebuilding and rerunning the server,
then watching the response in LiveGrapher. See state-space-guide.pdf
for advice on manually tuning a PID controller.
Use the folder name
live-grapher for this project. Once you
feel your motor is tracking the reference step inputs well, hit the "Clear
Data" button, let a couple reference changes with the motor response show
up on the graph, then save the graph data to a .csv file with the "Save"
button. Include this in your assignment submission repository alongside an
src folder containing all the files you used except the
Main.cpp that was removed. Do not forget your
DCMotor.cpp file which contains your modified PID gains.