configuration of the time in the case using remote API

Typically: "How do I... ", "How can I... " questions
dimsky
Posts: 4
Joined: 15 Mar 2021, 09:38

Re: configuration of the time in the case using remote API

Post by dimsky »

I am using version 4.1 to display dummy movement graphs in my simulation.

Now when I update to version 4.2 the hierarchy graph can't be found in my hierarchy scene. Please help so I can quickly solve this problem. because it concerns my final research project. can I use version 4.1 back as before? I think when I use version 4.2 it makes me have to study that version first, especially in Indonesia, I rarely find research references using Coppeliasim
please help, thank you

best regards
dimas tri saptaji

SitStudent
Posts: 23
Joined: 05 May 2020, 12:07

Re: configuration of the time in the case using remote API

Post by SitStudent »

you can download the previous versions here.
https://www.coppeliarobotics.com/previousVersions

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: configuration of the time in the case using remote API

Post by coppelia »

Additionally, you can enable old dialogs by setting showOldDlgs=true in system/usrset.txt

Cheers

SitStudent
Posts: 23
Joined: 05 May 2020, 12:07

Re: configuration of the time in the case using remote API

Post by SitStudent »

Hi

In the above code, is there any way to start a record when remoteAPI(regacy) is connected, and end it when it is disconnected?

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: configuration of the time in the case using remote API

Post by coppelia »

Hello,

try with following:

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')
    graph.init()
    startMeasurement()
end

function startMeasurement()
    startTime=sim.getSystemTime()
    graph.reset()
    measure=true
end

function stopMeasurement()
    measure=nil
end

function appendMeasurementPts()
    if measure then
        -- 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
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
and call startMeasurement and stopMeasurement.

Cheers

Post Reply