I have gotten a few questions about how I graphed my motor data in a spreadsheet, so I decsided to make a quick guide.
The goal is collect and display motor data.
I use #include <iostream> to output the data to terminal.
Now formating is really important. I use comma separated values formatting because it allows me to use a .csv file to store my data. (I wonder what csv stands for ).
Time is really important to graph when things happen, but it doesn’t necessarily have to be the brain’s timer. If you want you could have a timer related to when a shot is fired.
Then add the propper motor inforation you wan to output.
I use a code block that looks simliar to this depending on what I want to output inside the driver ctrl while loop(just make sure it loops).
This outputs the: time , velocity , torque , current , voltage
Run the test and the program will output the data in terminal. Now I copy all the data to clipboard and paste it into a csv file or Excel (not sure exactly how this works for windows bc I use a mac).
Issues that arise for me is that if I try to output too much data at once the data doesn’t sent correctly to the terminal. I solved that by increasing the amount of wait time for the loop.
Microsoft Excel and Google Sheets both support drawing graphs given rows/columns of data (and they support .csv files so it is really easy to import what you have collected from your robot).
In the example below (Excel), I have a column labeled “output” that contains arbitrary values. You would probably use your collected information instead. Under the Insert tab, there is a button to generate a line graph with the selected data.
In Sheets, the process is similar. Under the Insert tab, you would click on Chart to insert the graph. It should default to a line format, but you may have to change it in the chart options.
You could also use a library called Graphy if you’re using pros. Look it up on GitHub it has all the instructions for the setup which is quite easy. It didn’t work for me tho for some reason so I just copied and pasted the 4 files necessary into the right folders and it works fine.
It is referring to this area in VEXcode Pro (it’s at the bottom):
Example Code:
#include "vex.h"
#include <iostream>
using namespace vex;
int main() {
vexcodeInit();
// std:endl is used to flush the output buffer
std::cout << "Hello World!" << std::endl;
}
In VEXcode V5, there is an output console that is accessible by clicking the speedometer icon at the top right (directly next to the button you use to set the devices connected to the brain).
I do a similar thing but with flywheel speeds to make sensing easier; instead of copying the output from the terminal I just do “pros terminal > log.csv”. If you were using a cli you could probably do the equivalent