Hi there,
It would be nice to see some extra graph functionality added. Specifically:
1) Getting data through an API function (simGetGraphData)
2) Saving/exporting data through an API function (simExportGraphData)
3) Creating a graph (simCreateGraph)
4) Associating/Removing objects from graph (simAddGraphItem)
5) Changing graph colours (simSetObjectInt32Parameter)
I'd like to save a decent amount of data from simulation runs, but it's unfeasible to manually do it for each point. Right now my workaround is to add a child script to the graph object, and append information to a table on every sensing step.
Matt
Graph functionality
Re: Graph functionality
Hello Matt,
the general way of doing this is that have a graph that contains several user-defined data streams, and to feed them via the API with data (simSetGraphUserData) that you collect with various API functions (e.g. simGetObjectPosition, etc.).
Cheers
the general way of doing this is that have a graph that contains several user-defined data streams, and to feed them via the API with data (simSetGraphUserData) that you collect with various API functions (e.g. simGetObjectPosition, etc.).
Cheers
Re: Graph functionality
Agreed, adding and visualizing data on a graph is no problem. (4) was maybe a bit more of a convenience then a necessity.
But right now it doesn't look like there's much functionality for doing other manipulations with it. If for example I wanted to collect data and save data over a time range, I've had to do something like this:
Whereas the graph would have this information already. If instead of using signals and managing memory there was an equivalent function for getting recorded data from the graph object, e.g.:
and saving data:
it would make things a lot more streamlined. Right now there's no API equivalent for exporting data, although it can be done manually (Menu bar --> File --> Export --> Selected graphs as CSV...).
But right now it doesn't look like there's much functionality for doing other manipulations with it. If for example I wanted to collect data and save data over a time range, I've had to do something like this:
Code: Select all
if (sim_call_type==sim_childscriptcall_initialization) then
data_table = {}
end
if (sim_call_type==sim_childscriptcall_sensing) then
if simGetIntegerSignal("collectData") ~= nil then
table.insert(data_table, data)
end
if simGetIntegerSignal("resetData") ~= nil then
data_table = {}
end
if simGetIntegerSignal("saveData") ~= nil then
...
end
end
Code: Select all
r, data = simGetGraphData(stream_name, time_start, time_end)
Code: Select all
r = simExportGraphData(data)
-
- Posts: 11
- Joined: 09 Sep 2017, 01:10
Re: Graph functionality
+1 on a simple function for getting data out of a graph object buffer.
Re: Graph functionality
You have some undocumented graph functions, such as simGetGraphCurve. Have a look at the customization script located in lua/graph_customization.lua
Cheers
Cheers