configuration of the time in the case using remote API
-
- Posts: 23
- Joined: 05 May 2020, 12:07
configuration of the time in the case using remote API
Hi, there
I simulate one scene using remote API and output the graph which has a time as x axis but, considering procedure of using remote API, x axis(time) is from the start of simulation not start of the remote API system .
Therefore, I want to set the start of the x axis on the graph as start of the remote API.
Is there any way for that?
sincerely,
I simulate one scene using remote API and output the graph which has a time as x axis but, considering procedure of using remote API, x axis(time) is from the start of simulation not start of the remote API system .
Therefore, I want to set the start of the x axis on the graph as start of the remote API.
Is there any way for that?
sincerely,
Re: configuration of the time in the case using remote API
Hello,
currently you can only record graph value when simulation is running unfortunately. But this will be changed in next release (V4.2.0).
Cheers
currently you can only record graph value when simulation is running unfortunately. But this will be changed in next release (V4.2.0).
Cheers
-
- Posts: 23
- Joined: 05 May 2020, 12:07
Re: configuration of the time in the case using remote API
Thank you for your reply.
I use a remote api and lua child script on the scene at the same time. Is it possible lua script recognizes the moment remote API is connected on the child script?
I think about using sim.resetGraph.
Sincerely,
I use a remote api and lua child script on the scene at the same time. Is it possible lua script recognizes the moment remote API is connected on the child script?
I think about using sim.resetGraph.
Sincerely,
Re: configuration of the time in the case using remote API
Yes, this would be possible. However, there is a bug in current CoppeliaSim V4.1.0, where every graph would be automatically reset at simulation start, which is problematic for you. Next version will have that corrected.
Cheers
Cheers
-
- Posts: 23
- Joined: 05 May 2020, 12:07
Re: configuration of the time in the case using remote API
Ok, so...is it possible that you tell me when that will be launched?
If you don't mind, please tell me.
Sincerely,
If you don't mind, please tell me.
Sincerely,
Re: configuration of the time in the case using remote API
next release should be out in January/February 2021. In the mean time you can always collect the data and/or transmit it to an external application for display (e.g. Matlab, etc.)
Cheers
Cheers
-
- Posts: 23
- Joined: 05 May 2020, 12:07
Re: configuration of the time in the case using remote API
Hi
I updated new version of CoppeliaSim 4.2.0.
Actually, it's more useful for me to set a graph.
I really appreciate for that.
Then, about my topic, is my problem fixed by this new version of CoppeliaSim?
Sincerely,
I updated new version of CoppeliaSim 4.2.0.
Actually, it's more useful for me to set a graph.
I really appreciate for that.
Then, about my topic, is my problem fixed by this new version of CoppeliaSim?
Sincerely,
Re: configuration of the time in the case using remote API
Hello,
yes, you can now also record graph data points when simulation is not running. Have a look inside of lua/graph_customization.lua.
Cheers
yes, you can now also record graph data points when simulation is not running. Have a look inside of lua/graph_customization.lua.
Cheers
-
- Posts: 23
- Joined: 05 May 2020, 12:07
Re: configuration of the time in the case using remote API
Thank you
I saw the scripts inside lua\graph_customization.
However, I've never used these lua files inside CoppeliaSimEdu\lua so I couldn't make sense which scripts I should use.
If you don't mind, could you teach me which scripts I should use?
sincerely,
I saw the scripts inside lua\graph_customization.
However, I've never used these lua files inside CoppeliaSimEdu\lua so I couldn't make sense which scripts I should use.
If you don't mind, could you teach me which scripts I should use?
sincerely,
Re: configuration of the time in the case using remote API
Open the customization script attached to your graph, then past following code instead:
In above code, the x-position of object cube will be displayed in the graph. On the x-axis, you'll have the real time, in seconds. When simulation is not running, there will be a new point added only one time every 8 seconds on average. To change that to say 25, do:
When a change was made in the customization script, make sure you restart it by clicking the restart script button in the script editor.
Cheers
Code: Select all
graph=require('graph_customization')
function sysCall_init()
graphHandle=sim.getObjectHandle(sim.handle_self)
-- Create/update data streams/curves:
sim.destroyGraphCurve(graphHandle,-1)
stream1=sim.addGraphStream(graphHandle,'Object position X','m')
objectHandle=sim.getObjectHandle('cube')
startTime=sim.getSystemTime()
graph.init()
end
function appendMeasurementPts()
-- append measurement points, e.g. the x-position of an object:
local p=sim.getObjectPosition(objectHandle,-1)
sim.setGraphStreamValue(graphHandle,stream1,p[1])
graph.handle(sim.getSystemTime()-startTime)
graph.updateCurves()
end
function sysCall_sensing()
appendMeasurementPts()
end
function sysCall_nonSimulation()
appendMeasurementPts()
end
function sysCall_suspended()
appendMeasurementPts()
end
function sysCall_beforeSimulation()
end
function sysCall_afterSimulation()
end
function sysCall_suspend()
end
function sysCall_resume()
end
Code: Select all
sim.setInt32Parameter(sim.intparam_idle_fps,25)
Cheers