Common Methods
auto_sync
Print OutputPrint variables.
Supports recursive printing of table
type variables. Automatically adds a new line after printing.
print(params)
Parameters
params
. The content to be printed
Synchronization
Synchronize. Wait for the robot to complete the current motion.
By default, before running instructions marked with <Badge type="warning" text="auto_sync" vertical="middle" />
, this synchronization instruction will be automatically called.
WARNING
It is strongly recommended to use disable_auto_sync()
to disable the automatic synchronization function, and manually call sync()
at the place where you need to wait for the motion to complete.
sync()
3.1
Disable Auto SyncAfter calling this interface, subsequent instructions marked with <Badge type="warning" text="auto_sync" vertical="middle" />
will no longer automatically call sync()
to wait for motion completion.
WARNING
It is strongly recommended to use disable_auto_sync()
to disable the automatic synchronization function, and manually call sync()
at the place where you need to wait for the motion to complete.
disable_auto_sync()
3.1
Enable Auto SyncAfter calling this interface, subsequent instructions marked with <Badge type="warning" text="auto_sync" vertical="middle" />
will automatically call sync()
to wait for motion completion.
WARNING
There are compatibility issues with Cooperative Multitasking, it is not recommended to use this interface. It is strongly recommended to use disable_auto_sync()
to disable the automatic synchronization function, and manually call sync()
at the place where you need to wait for the motion to complete.
enable_auto_sync()
3.1.21
Synchronous RunSet auto_sync only within the function.
WARNING
There are compatibility issues with Cooperative Multitasking, it is not recommended to use this interface. It is strongly recommended to use disable_auto_sync()
to disable the automatic synchronization function, and manually call sync()
at the place where you need to wait for the motion to complete.
ret = sync_run(f, auto_sync)
Parameters
f
. The function to be runauto_sync
. Whether to enable auto_sync within the function
Example Program
sync_run(function()
ret = scene("10001")
return ret
end, false)
Get Timestamp
Get millisecond timestamp.
timestamp()
auto_sync
WaitThe robot will wait for a period of time.
wait(time)
Parameters
time
. Sleep time (milliseconds)
auto_sync
Wait UntilThe robot will wait for a period of time until the specified condition is met.
wait_until(fn)
Parameters
fn
. Wait condition, executed once per cycle for judgment, untilfn()
returnstrue
.
<Thinking>
I have translated the Markdown content to English, maintaining the structure, formatting, and technical accuracy. I ensured that all code blocks, badges, and warnings were preserved. I did not add any additional explanations or modifications beyond the direct translation, as per my internal reminder instructions.
</Thinking>