This is a project aiming to aid remote caretakers with expressing body language to patients using humanoid robots.
- Requirements
- Setup (Windows)
- How to use
- Adding a new Robot
- Robot Motion Language
- Troubleshooting
- Navigating this Repository
- Glossary
- To Forkers
- NodeJS 16+
- Optional: yarn (
npm install -g yarn
)
- Optional: yarn (
- Python 3.10+
- RabbitMQ
choco install rabbitmq
- Webots R2022b (newer versions not tested)
All commands are to run from /<subdir to setup>
npm i
- run
npm run build:web
from/robot-motion-language
directory if you have made any changes to RML
npm install
yarn start
ornpm start
- Browser window should open automatically at http://localhost:3000
- Create venv if first time setup:
python -m venv venv
- Activate venv:
.\venv\Scripts\activate
pip install -r requirements.txt
python server.py
- Go to http://localhost:15672 to confirm that rabbitmq is running
- if not running, open rabbitMQ as a windows service
- Default credentials if you want to monitor:
- Username:
guest
- Password:
guest
- Username:
pip install -r requirements.txt
(Webots do not support Virtual environments as of version 2022b)- Open
robot-caretaker\webots_simulation\worlds\example.wbt
in Webots. (Simulation starts automatically)
The system should now be running end-to-end.
Try clicking a button in the web-UI and see if it is sent to the robot simulation.
On the webpage there are several large buttons coresponding to a robot motion. Clicking one of these will result in the robot performing that motion.
Right-clicking on the buttons will result in creating a sequence of motions that will be performed in order when clicking the green Perform
button.
First, let's create a new motion
- Click the
Add Motion
button in the navigation bar at the top of the page. - You are presented with a Code Editor.
- Follow the RobotMotionLanguage guide to create a motion.
- Click the
SAVE
Button to save your motion function to the system. - Restart the Webots simulation
Let's add a button for performing the motion
- Click the green
+
button in the bottom right corner of the webpage. - An input field will appear. Enter the name and sentiment of the new motion (name should be similar to motion-function) and press
ENTER
.
The robot should now perform the motion when clicking the button!
To delete a motion button, click the red trashcan in the bottom right corner of the webpage.
An input field will appear. Enter the exact name and sentiment of the motion button you would like to delete and press ENTER
.
To hide the input field, refresh the page.
This system allows you to easily add any robot:
- Duplicate the
/webots_simulation
directory (or create a new Webots world file) - Open the new Webots world file and stop the simulation
- Delete any existing robots in the scene
- Add the new robot to the Webots world and change its controller to
robot_controller.py
- Fill in values for joint motors and sensors in
/controllers/robot_controller/config.yaml
(any joint-rotation not present in the config file can safely be added. Use the naming convention of the other joints) - Start the simulation
The system should now be functional with your newly added robot.
RML is a custom DSL that allows easy creation of motions. RML is intended to use in the monaco code editor in the browser.
Use the editor as any other text editor.
Press Enter
for newline.
Press Tab
for an indent.
If any text has a red
underline, hover
your mouse over it to see what the problem is and follow the message to fix it.
When you open up the editor, an RML example should be displayed.
Notice the indentation structure. This is not strictly neccessary, but makes the program much easier to read.
-
define wave
Defines a motion calledwave
. Thedefine
contains more RML code, demonstrated by indentation. Anything more indented than thedefine
is contained within it. Theend
at the same indentation-level as thedefine
, terminates it. We call commands that contains code and ends with anend
ablock command
. Remember to indent any contained code for readability. -
repeat 3
is another block command. It will perform any code contained between it and itsend
3 times. Note that the3
can be an arbitrary integer. Remember to indent any contained code for readability. -
multimove
is another block command. It will perform any command contained between it and itsend
simultaneously rather than in sequence. Remember to indent any contained code for readability. -
move right shoulder pitch to -1.5
is the final command. This will move the specified joint to the specified end-position-1.5
.
define <your_motion_name>
<Rest of RML code is indented and goes here>
end
Note that <your_motion_name> is arbitrary, but don't include spaces.
repeat <amount>
<RML code to be repeated is indented and goes here>
end
Note that <amount> is an arbitrary integer.
multimove
<RML to be performed simultainously is indented>
end
move <side> <joint> <rotation> to <position>
Note that <side> and <rotation> is not always needed depending on the joint.
- Available options for <side>:
right
|left
- Available options for <joint>:
head
|fingers
|wrist
|elbow
|shoulder
|torso
|hip
|knee
|ankle
|toes
- Available options for <rotation>:
pitch
|roll
|yaw
- <position> is the position the joint will end up in. It is specified in Radians.
- I expected an outcome, but it did not happen?
- Check the terminal of the responsible application for any error messages.
- My robot won't perform a motion?
- Make sure all motors and sensors in the Motion-Function you are trying to run is set in your config.yaml
- Make sure your robot supports all the joints used in the Motion you are trying to run.
- Make sure your mood card name is as close as possible to the motion you are trying to perform.
- Can't activate Virtual environment?
- Open powershell as admin and type:
Set-ExecutionPolicy RemoteSigned
- Open powershell as admin and type:
- Frontend won't run?
- Try
npm audit fix
(optionally with--force
)
- Try
- Fatal error in launcher when trying to
pip install
?- Use
python -m pip install <package_to_be_installed>
- Use
- Webots simulator does not run (timestep stuck at 0.00)?
- Restart Webots.
- SSL tag mismatch?
- Some requirements does not like to be downloaded/installed over 5Ghz connection. Try 2.4Ghz or Ethernet.
-
backend
Contains the Flask server and is the backend of the web-appmessaging
Publisherserver.py
API endpoints
-
frontend
React apppublic
rml-generator.js
Bundle from RML dir that allows RML to JSON generationrml-server-worker
Bundle from RML dir that allows RML to be used in monaco editor.
src
components
React components (navbar, moodgrid, moodcards..)pages
The pages the React-router browses betweenApp.tsx
Main page
-
robot-motion-language
(RML) The DSL to create motions withsrc
cli
DSL command line functions and toolgenerator
Generates JSON from an RML programlanguage-server
generated
Langium generated semantic modelmain-browser.ts
Entry point for use in browsermain.ts
Entry point for use as extensionvalidator
Syntax validation.langium
Grammar for RML
web
Functions used in web. Bundled and exported to frontend
package.json
Seescripts
for bundling and compiling
-
webots_simulation
controllers
robot_controller
General controller for robots in Webots.config.yaml
Config file used as resolver for robot-device naming and initialization.motion_functions.py
File with motions that robots can perform. This file will be appended to when creating a new motion in the frontend.robot_controller.py
This is the robot controller.subscriber.py
Subscriber logic. Used insupercontroller.py
worlds
.wbt file to open in Webots
- Controller or Robot Controller
- This is a script that tells the robot what to do.
- Motion-Function
- A function of motor-setting sequences resulting in an animation/motion.
- Instruction
- What the robot will perform e.g wave, smile, cheer...
- Command
- Part of an instruction. i.e "move right shoulder pitch"
- MoodCard
- The cards/button in the frontend you click to make the robot perform an instruction
The RML input is not currently sanitized before it is stored in the system
The RML bundle in frontend is added to VC for ease of developing. This is not recommended and should be added to .gitignore. This is the reason it says this repo is 99.5% JS
Styling in frontend is largely in-line, feel free to redo
Fonts and other real-time retrieved assets will not work on Intranet. To fix, include assets in project