Vrep脚本的执行顺序
具体情况看这个答案:
Problems about simulation loop - V-REP Forum
http://www.forum.coppeliarobotics.com/viewtopic.php?f=9&t=5856&p=23502&hilit=cascaded+order#p23502
Vrep 中non-threaded child scripts的执行顺序是未知的但是可以人为指定。
1.使用Scirpt toolbar button
2.使用sim.switchThread()
Description | Allows specifying the exact moment at which the current thread should switch to another thread. If the current script doesn't run in a thread (i.e. if it runs in the application main thread), this function has no effect. By default, V-REP doesn't use "regular" threads, but something similar to hybrid threads (which behave like coroutines, but can also behave like regular threads). This allows much more flexibility and execution control of the threads: each thread (except for the main or application thread) has a switch timing associated, which specifies how long the thread will run before switching to other threads. By default this value is 2 millisecond, but can be modified with sim.setThreadSwitchTiming. That timing can be shortened with sim.switchThread. Use with care when calling this function from a plugin. See also the sim.setThreadAutomaticSwitch, sim.setThreadResumeLocation and sim.setThreadIsFree functions. |
Lua return values |
result: 1 if the thread was switched (the current thread gave control to other threads until the next calculation pass), 0 if it was not switched (e.g. because the function was called from the main or application thread), or -1 in case of an error.
|