Hello
I am trying below youtube tutorial.
https://www.youtube.com/watch?v=vRi2Up0yfyk&t=1511s
This tutorial is used V-rep Verision.
I wrote the program shown at 35 minutes and 59 seconds of this video.
I can not find "sim.getScriptSimulationParameter" and "sim.setScriptSimulationParameter" in script of Coppelia.
Where can I find API functions to replace the above two API functions?
Cheers
What API function can replace sim.getScriptSimulationParameter and sim.setScriptSimulationParameter?
-
- Posts: 7
- Joined: 31 Aug 2020, 06:45
Re: What API function can replace sim.getScriptSimulationParameter and sim.setScriptSimulationParameter?
Hello,
please use following API functions instead:
Cheers
please use following API functions instead:
Cheers
-
- Posts: 7
- Joined: 31 Aug 2020, 06:45
Re: What API function can replace sim.getScriptSimulationParameter and sim.setScriptSimulationParameter?
Hello Coppelia
Thanks for the replay.
Below is the program I wrote.
My scene can download below URL .
https://drive.google.com/file/d/1RR9P7R ... sp=sharing
I replaced sim.getScriptSimulationParameter and sim.setScriptSimulationParameter to sim.setUserParameter and sim.getUserParameter.
But, I get an error in function actuateMagnet(ui).
I guess, Is the double quotation in the wrong position?
Honestly, I don't know what double quotation means and using of sim.setUserParameter and sim.getUserParameter.
I'm sorry for the inconvenience, can you confirm this for me?
cheers
Thanks for the replay.
Below is the program I wrote.
Code: Select all
function sysCall_init()
arm=sim.getObjectHandle("Arm_actuator")
crab=sim.getObjectHandle("Crab_actuator")
hoist=sim.getObjectHandle("Hoist_actuator")
suction=sim.getScriptHandle("suctionPad")
xml = [[
<ui title="Floor Customizer" closeable="true" on-close="closeEventHandler" resizable="false" activate="false">
<group layout="form" flat="true">
<label text="Arm speed (rad/s): 0.00" id="1"/>
<hslider tick-position="above" tick-interval="1" minimum="-10" maximum="10" on-change="actuateArm" id="2"/>
<label text="Crab speed (m/s): 0.00" id="3"/>
<hslider tick-position="above" tick-interval="1" minimum="-10" maximum="10" on-change="actuateCrab" id="4"/>
<label text="Hoist speed (m/s): 0.00" id="5"/>
<hslider tick-position="above" tick-interval="1" minimum="-10" maximum="10" on-change="actuateHoist" id="6"/>
<label text="Magnet" id="7"/>
<button text="deactivated" on-click="actuateMagnet" checkable="true" id="8"/>
</group>
<label text="" style="* {margin-left: 400px;}"/>
</ui>
]]
ui=simUI.create(xml)
end
function actuateArm(ui,id,newVal)
local val = 0.02*newVal
sim.setJointTargetVelocity(arm,val)
simUI.setLabelText(ui,1,string.format("Arm speed (rad/s): %.2f",val))
end
function actuateCrab(ui,id,newVal)
local val = 0.15*newVal
sim.setJointTargetVelocity(crab,val)
simUI.setLabelText(ui,3,string.format("Crab speed (m/s): %.2f",val))
end
function actuateHoist(ui,id,newVal)
local val = 0.25*newVal
sim.setJointTargetVelocity(hoist,val)
simUI.setLabelText(ui,5,string.format("Hoist speed (m/s): %.2f",val))
end
function actuateMagnet(ui)
local state = sim.getUserParameter(suction,"active","true")
if state then
sim.setUserParameter(suction,"active","false")
simUI.setButtonText(ui,8,"deactivated")
else
sim.setUserParameter(suction,"active","true")
simUI.setButtonText(ui,8,"activated")
end
end
https://drive.google.com/file/d/1RR9P7R ... sp=sharing
I replaced sim.getScriptSimulationParameter and sim.setScriptSimulationParameter to sim.setUserParameter and sim.getUserParameter.
But, I get an error in function actuateMagnet(ui).
I guess, Is the double quotation in the wrong position?
Honestly, I don't know what double quotation means and using of sim.setUserParameter and sim.getUserParameter.
I'm sorry for the inconvenience, can you confirm this for me?
cheers
Re: What API function can replace sim.getScriptSimulationParameter and sim.setScriptSimulationParameter?
What kind of error message do you get?
The functions I mentioned are of course not directly compatible with sim.getScriptSimulationParameter / sim.setScriptSimulationParameter. Use either one set of functions, or the other. But do not expect
Of course you could continue to use sim.getScriptSimulationParameter / sim.setScriptSimulationParameter: those functions are deprecated, but still working.
Cheers
The functions I mentioned are of course not directly compatible with sim.getScriptSimulationParameter / sim.setScriptSimulationParameter. Use either one set of functions, or the other. But do not expect
sim.getUserParameter
to read parameters written with sim.setScriptSimulationParameter. This also means the suctionCup code needs to be adapter.Of course you could continue to use sim.getScriptSimulationParameter / sim.setScriptSimulationParameter: those functions are deprecated, but still working.
Cheers