Move multiple joints at one
-
- Posts: 19
- Joined: 30 Dec 2020, 15:32
Move multiple joints at one
How can I move two revolute joints simultaneously?Lua follows a line-by-line approach and I was just wondering if there is a way to move two joints simultaneously.
Re: Move multiple joints at one
Functions such as
sim.setJointPosition
or sim.setJointTargetPosition
return immediately, so if you sequentially set position of joint 1 then position of joint 2, those will move simultaneously (if inside a threaded script, you need to momentarily disable thread switching to make sure simulation doesn't advance in-between the two calls)-
- Posts: 19
- Joined: 30 Dec 2020, 15:32
Re: Move multiple joints at one
How do I disable thread switching momentarily in remote API?
Re: Move multiple joints at one
You can disable thread switching in embedded child scripts.
In case of remote API, you probably want to use synchronous operation.
In case of remote API, you probably want to use synchronous operation.
Re: Move multiple joints at one
to disable and enable again thread switching in a threaded script, do something like:
Cheers
Code: Select all
-- temporarily disable thread switching:
fl=sim.setThreadSwitchAllowed(false)
-- enable thread switching again:
sim.setThreadSwitchAllowed(fl)