Common Methods

Print 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()

Disable Auto Sync <Badge type="tip" text="3.1" vertical="bottom" />

After 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()

Enable Auto Sync <Badge type="tip" text="3.1" vertical="bottom" />

After 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()

Synchronous Run <Badge type="tip" text="3.1.21" vertical="bottom" />

Set 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 run

  • auto_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()

Wait <Badge type="warning" text="auto_sync" vertical="middle" />

The robot will wait for a period of time.

wait(time)
  • Parameters

  • time. Sleep time (milliseconds)

Wait Until <Badge type="warning" text="auto_sync" vertical="middle" />

The 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, until fn() returns true.


<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>