Lua Socket Service

  • Port: 5180. Runs in serial task, all connections share the execution environment. Controls the current environment's robot.
  • Port: 3010. Runs in parallel task, each connection has independent execution environment. Controls virtual environment robot.
  • Port: 3011. Runs in parallel task, each connection has independent execution environment. Controls real robot environment.

WARNING

After disconnection and reconnection on 301x ports, all data including variables and functions will be cleared

This service accepts Lua code data streams and adds them to the execution queue. Output is pushed to the client when print is used.

Lua Socket service supports Basic Lua Syntaxopen in new window, Lua SDK and Lua API.

Directly accessing the code parsing service and submitting commands will not show all task execution history on the control page, and cannot use related safety features such as position safety confirmation. Please ensure risks before directly operating the robot through the code parsing service.

Using this service, you need to handle robot state and task running state yourself, and parse the response data stream yourself. Commands are not executed immediately; they can only be executed when idle or stopped. Otherwise, the command will wait for all currently executing logic to complete before starting to run - which may happen much later.

Compatibility Note

When sending a large number of Lua instructions, add program_begin(0) and program_end(0) instructions before and after the data stream. For example:

program_begin(0)
print("...")
program_end(0)

The parser will execute the code in between as a whole, otherwise the actual execution order cannot be guaranteed.