LED Board

Load Sound and Light Style from Resource Library

Read the saved LED style.

  • Function name: Method load_led_style under [Robot]
  • Parameters:
    1. name: [str] Name
    2. dir: [str] Workspace name. Optional, default root directory
  • Return: [LedStyle] Sound and light style
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "load_led_style", "params": [{"name": "", "dir": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"led": {}, "voice": 0, "volume": 0}, "id": 1 }

Example Program

style = lebai:load_led_style("style1")
print(style)

Set Sound and Light Style

Set LED style (mode, speed, color, sound, volume).

  • Function name: Method set_led_style under [Robot]
  • Parameters:
    1. style: [LedStyle] Sound and light style
  • Return: None

Example Program

style = {mode = 2, speed = 1, colors = {0, 1, 2}, voice = 1, volume = 2}
lebai:set_led_style(style)

Set LED Light Status

  • Function name: Method set_led under [Robot]
  • Parameters:
    1. mode: [int] Light mode.
      • 0 Unchanged.
      • 1 Off.
      • 2 Solid.
      • 3 Breathing.
      • 4 Even rotation.
      • 5 Same color rotation.
      • 6 Blinking.
    2. speed: [int] Speed.
      • 1 Fast.
      • 2 Normal.
      • 3 Slow.
    3. colors: [list[int]] Up to 4 integers between 0~15, corresponding colors as follows:
  • Return: None
  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

Example Program

lebai:set_led(3, 1, {0, 1, 2})
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "set_led", "params": [{"mode": 1, "speed": 1, "colors": [0]}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }

Set Sound

  • Function name: Method set_voice under [Robot]
  • Parameters:
    1. voice: [int] Sound list.
      • 0 Unchanged
      • 1 Xiaobai is starting up, please wait
      • 2 Xiaobai is trying to stop
      • 3 Warning, collision detected
      • 4 Updating, please wait
      • 5 Teaching mode enabled
      • 6 Teaching mode exited
      • 7 Fine-tuning started
      • 8 Fine-tuning ended
      • 9 Fine-tuning direction changed
      • 10 Xiaobai is so bored, let's play a game together
    2. volume: [int] Volume.
      • 0 Mute.
      • 1 Low.
      • 2 Normal.
      • 3 High.
  • Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "set_voice", "params": [{"voice": 1, "volume": 1}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }

Example Program

lebai:set_voice(1, 2)

Toggle Fan

Note

When the system detects that the robot operating temperature is too high, it will automatically turn on the cooling fan.

  • Function name: Method set_fan under [Robot]
  • Parameters:
    1. mode: [int] Fan mode.
      • 1 Off.
      • 2 On.
  • Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "set_fan", "params": [{"mode": 1}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }

Example Program

lebai:set_fan(2)