Pagetitle |
---|
| Robot scripts |
---|
| Robot scripts |
---|
|
Scripts allow you to program a robot to perform specific actions. Scripts folder path: /opt/promobot/share/promobot_scripts/scripts/3.1/ The script is a json text file that can contain the following modules: - arms
- neck
- torso
- drive
- eyes
- led
- play
- play_motion
- promo
- bash
Подсказка |
---|
The launch of modules happens in parallel. Each command should have a unique id in module scope. |
Arms module: Предупреждение |
---|
Модуль arms не имеет встроенного ограничения. При выполнении скрипта робот может ударить сам себя. Для выполнения скриптов с использованием рук рекомендуется использовать сервис MSS |
A hand movement command is: Блок кода |
---|
"arms": [{"command": "x0 x1 x2 x3 x4 x5 x6 x7 x8", "id": 0}] |
Parameter | Description | Value |
---|
x0 | which hand to move | left or right | x1 | speed of movement | int | x2 | direction of movement of the arm along the body of the robot | int | x3 | direction of movement of the arm from the body of the robot | int | x4 | turn of the arm in the shoulder | int | x5 | elbow flexion | int | x6 | turn of the arm at the elbow | int | x7 | hand movement | int | x8 | finger movement | int |
Neck module:A neck movement command is:
Блок кода |
---|
"neck": [{"command": "angle x0 x1 x2", "id": 0}] |
Parameter | Description | Value |
---|
x0 | speed of movement | int | x1 | head turning right / left | int | x2 | head turning up / down | int |
Torso module:A torso movement command is:
Блок кода |
---|
"torso": [{"command": "angle x0 x1 x2 x3", "id": 0}] |
Parameter | Description | Value |
---|
x0 | speed of movement | int | x1 | tilt forward / backward | int | x2 | tilt left / right | int | x3 | movement up / down | int |
Drive module:A drive command is: Блок кода |
---|
"drive": [{"command": "x0 x1", "id": 0}, {"command": "sleep x2", "id": 1}] |
Parameter | Description | Value |
---|
x0 | direction of movement | forward , back , right , left
(left , right - turn around its axis) | x1 | speed of movement | int | x2 | time in seconds | int |
Предупреждение |
---|
Linear velocity for forward and back commands is set in the range: 0 - 1.0 (where 0.5 is comparable to the speed with the B button held down on the controller (gamepad), and 1.0 is comparable to the speed with the A button held down). The angular velocity for the left and right commands is set in the range: 0 - 5.0 (where 2.5 is comparable to the speed with the B button held down on the controller (gamepad), and 5.0 is comparable to the speed with the A button held down). |
Eyes module:An eyes command is:
Блок кода |
---|
"eyes": [{"command": "pub x0", "id": 0}] |
Parameter | Description |
---|
x0 | anger.gif | default.gif | heart.gif | laugh.gif | sad_wave.gif | scan.gif | smile.gif | sorrow.gif | surprise.gif | wink.gif |
Led module:A led command is:
Блок кода |
---|
"led": [{"command": "pub head x0 x1 x2 x3 x4 x5", "id": 0}] |
Parameter | Description | Value |
---|
x0 |
| sharp_blink
sharp_on
sharp_off
| smooth_blink
smooth_on
smooth_off
| x1 | switch-on / switch-off time (no more than 65 seconds) | int | x2 | кол-во циклов (для sharp_blink и smooth_blink ) | int | x3 | RGB-color of illumination | HEX-format, e.g., #FFFFFF | x4 | sector (total 9 sectors available) | int 0 - all on | x5 | whether to keep the sector light on in the next iteration or not | boolean |
Play module:A play command is:
Блок кода |
---|
"play": [{"command": "play x0", "id": 0}, {"command": "sleep x1", "id": 1}, {"command": "stop", "id": 2}] |
Parameter | Description | Value |
---|
x0 | audio file name with extension | e.g., song.mp3 | x1 | time in seconds | int |
Предупреждение |
---|
For correct playback of the audio file, it must be located in /home/promobot/Music |
Play_motion module:A play_motion command is: Блок кода |
---|
"play_motion": [{"command": "play x0", "id": 0}, {"command": "sleep x1", "id": 1}] |
Parameter | Description | Value |
---|
x0 | script name with the .yaml extension | e.g., script.yaml | x1 | time in seconds | int |
A promo command is: Блок кода |
---|
"promo": [{"command": "url x0", "id": 0}, {"command": "sleep x1", "id": 1}] |
Parameter | Description | Value |
---|
x0 | image name with extension, or a link to the site | e.g., image.jpg | x1 | time in seconds | int |
Предупреждение |
---|
Promotional material will be displayed only if the robot is launched (Play button is pressed). The image file must be located in /home/promobot/Pictures |
Bash module:A bash command is:
Блок кода |
---|
"bash": [{"command": x0, "id": 0}] |
Parameter | Description | Value |
---|
x0 | bash script path | e.g., "opt/promobot/share/promobot_scripts/scripts/3.1/UpVolume.sh" |
Предупреждение |
---|
Script must be executable |
Example of using several modules in a script: Блок кода |
---|
| {
"parts": [{
"arms": [{
"command": "right 50 45 0 0 0 0 0 0",
"id": 0
}, {
"command": "left 50 0 0 0 45 0 0 0",
"id": 1
}, {
"command": "sleep 3.0",
"id": 3
}, {
"command": "right 50 0 0 0 0 0 0 0",
"id": 4
}, {
"command": "left 50 0 0 0 0 0 0 0",
"id": 5
}]
}
# left and right hands will take the preset position
# robot will wait for 3 seconds, then return the arms to their original position
, {
"neck": [{
"command": "angle 20 0 20",
"id": 0
}, {
"command": "sleep 3.0",
"id": 1
}, {
"command": "angle 20 0 0",
"id": 2
}]
}
# robot will tilt its head down, wait for 3 seconds, then return to its original position
, {
"torso": [{
"command": "angle 20 20 0 0",
"id": 0
}, {
"command": "sleep 3.0",
"id": 1
}, {
"command": "angle 20 0 0 0",
"id": 2
}]
}
# robot will tilt forward, wait 3 seconds, then return to its original position
, {
"drive": [{
"command": "forward 0.5",
"id": 0
}, {
"command": "sleep 1.0",
"id": 1
}, {
"command": "left 0.5",
"id": 2
}, {
"command": "sleep 1.0",
"id": 3
}]
}
# robot will move forward for 1 second, then will rotate counterclockwise for 1 second
, {
" | play_motionplayscriptyamlgif",
"id": 0
}, {
"command": "sleep | 603.0",
"id": 1
}]
}
# hearts will appear on the robot's face
, {
" | eyesheart.gifhead sharp_on 65 1 #c51111 0 false",
"id": 0
}, {
"command": "sleep 3.0",
"id": 1
}]
}
# the ears of the robot will light up red for 3 seconds
, {
"play": [{
"command": "play song.mp3",
"id": 0
}, {
"command": "sleep 30",
"id": 1
}, {
"command": "stop",
"id": 2
}]
}
# melody will start playing for 30 seconds
, {
"play_motion": [{
"command": "play script.yaml",
"id": 0
}, {
"command": "sleep 60.0",
"id": 1
}]
}
# MSS script will start and run for 60 seconds
, {
"promo": [{
"command": "url Image.jpg",
"id": 0
}, {
"command": "sleep 5",
"id": 1
}, {
"command": "url https://google.com",
"id": 2
}, {
"command": "sleep 5",
"id": 3
}]
}
# picture will be displayed on the screen and the website will be displayed 5 seconds later
, {
"bash": [{
"command": "/opt/promobot/share/promobot_scripts/scripts/3.1/UpVolume.sh",
"id": 0
}]
# UpVolume.sh script will run
}]
|
|