You are here

Custom plots in VESC - Tool

6 posts / 0 new
Last post
kinzma
Offline
Last seen: 1 week 3 days ago
VESC Free
Joined: 2017-10-06 10:19
Posts: 9
Custom plots in VESC - Tool

Hello Everyone,

I am curious if others would also like the following feature to come to vesc-tool :

I have used the vesc for some scientific stuff and it would be real handy if the vesc tool offered a general purpose method to graph the output given to it by custom user apps. In my latest case that was the pressure within a hydraulic system where i controlled the pump using the vesc and connected a pressure probe to an adc. I have actually implemented such a thing and had it running for a while now simply using another slot to listen to the vesc->commands(),SIGNAL(printReceived(QString)) and stripping the data off of print commands I used in my app.These consisted of an identifier as well as the data which enables plotting multiple values at once. I don't know if its the most efficient thing in the world but it worked well for me. Used an additional tab in pagertdata to display. One reason I ask is its kind of a pain to reapply the changes to new versions of vesc tool as I like to stay up to date but if this is too much of a niche I will keep doing that. 

Anybody else interested ? --> if so I would ask and work with benjamin to implement/merge this after some appropriate testing.

Regards

Max

oaigoiajsd
Offline
Last seen: 4 years 4 months ago
Joined: 2019-08-23 18:07
Posts: 1

Hey Max, this would be really useful. I'm looking at implementing the same feature for robotics applications which use custom VESC firmware.

benjamin
Offline
Last seen: 2 weeks 2 days ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

I have added almost exactly that to our self driving model car platform, and it should be quite easy to add it to VESC Tool tool. The commands there are:

// Clear and initialize new plot with the namex and namey axis names
void commands_init_plot(char *namex, char *namey);

// Add graph to plot with name as legend
void commands_plot_add_graph(char *name);

// Select which graph to add data to
void commands_plot_set_graph(int graph);

// Add xy sample to selected graph
void commands_send_plot_points(float x, float y);

The UI can then be used to select which graphs are active and save the plots as PDF, PNG or XML data. The XML data can also be re-imported later.

I will have a look at it for the next release, or the one after.

kinzma
Offline
Last seen: 1 week 3 days ago
VESC Free
Joined: 2017-10-06 10:19
Posts: 9

Hey Benjamin,

Thank you very much for having a look at it. Looking forward to seeing it in future versions.

If I got that right you basically have an implementation ready to go that seems to offer more features than mine - If you need my code/help in any way just let me know.

benjamin
Offline
Last seen: 2 weeks 2 days ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

I have added experiment plots to the latest version (VT 1.18, FW 3.60) now. You can use it like this:

commands_init_plot("Sample", "Voltage");
commands_plot_add_graph("Temp Fet");
commands_plot_add_graph("Input Voltage");
float samp = 0.0;

for(;;) {
	commands_plot_set_graph(0);
	commands_send_plot_points(samp, mc_interface_temp_fet_filtered());
	commands_plot_set_graph(1);
	commands_send_plot_points(samp, GET_INPUT_VOLTAGE());
	samp++;
	chThdSleepMilliseconds(10);
}

Usually I register some terminal command to initialize the plots and set a state variable to feed them with data.

This is what it looks like in VESC Tool:

experiment_plot.png

You can have up to 5 graphs which can be enabled or disabled with the buttons at the top. The graphs can have names (which are shown in the legend) and you can also name the axes. The plotted data can be stored to XML files, which can be opened later. PNG and PDF export is also possible. I might add CSV export at some point.

jfaille
Offline
Last seen: 10 months 5 days ago
Joined: 2017-10-26 06:34
Posts: 4

Hello VESC Team,

Awesome work on the new version of the VESC tool.  I was wondering if there was more documentation on creating plots in the new VT 3.0.  I'm using the VESC in a dyno setup and would love to have access to read and plot more data including ADC values.  If anyone has done that it would be really helpful if you could point me in the right direction.  Many thanks.  

J