Skip to content

sskorol/minipupper-teleop

Repository files navigation

MiniPupper Teleop

Build Status

This project allows streaming video from MiniPupper via WebRTC and teleoperating it via ROS. Note that the backend expects you've already connected OAK-D Lite camera to your robot. If you don't have one yet, you can still teleoperate the robot via keyboard, but w/o a camera stream. Also, note that technically you are not forced to use this project with MiniPupper only. It should work for any robot with OAK camera.

pupper_rgb_depth_teleop_new.mp4

Architecture

The following diagram reflects the most recent implementation:

RoboticsDiagram

  • roscore: a master node that handles all the ROS requests;
  • rosbridge: WS proxy between FE and ROS that accepts messages (keys) from the remote browser and passes them to ROS nodes;
  • webrtc-be: Python BE, which streams OAK-D Lite camera video to the remote browser via WebRTC (internally uses DepthAI API);
  • teleop-fe: ReactJS FE which uses roslibjs to communicate with ROS bridge and WebRTC API for camera streaming;
  • servo-drv: MiniPupper's servo driver node, which listens to CHAMP messages and changes joints' angles;
  • CHAMP/vel-smoother: CHAMP framework controls the robot's movements;
  • teleop: a slightly modified teleop-legged-robots node that accepts remote keys rather than local keyboard events.

Note that velocity-smoother was intentionally splitted from champ due to netwroking issue mentioned in a known issues section.

Installation

The following ROS image already comes with all the required drivers pre-installed. Just flash it to SD card and you are almost ready to go.

Check the official guide if you don't have Docker yet. Note that you need both docker and docker-compose CLI tools installed on MiniPupper.

Clone the source code:

git clone https://github.com/sskorol/minipupper-teleop.git && cd minipupper-teleop

Prepare calibration and env files:

./generate_configs.sh [MINI_PUPPER_IP_ADDRESS]

Adjust angles in calibration_settings.yaml to match your own robot's calibration data. Note that MiniPupper's legs should be calibrated to 90 degress as on the following screenshot, as CHAMP framework automatically adjusts angles during bringup process to make your robot stand:

image

MiniPupper's IP is required for the FE container to be able to communicate with the BE via remote browser.

Use the following steps to relax your web-browser restrictions:

  • Open Chrome
  • Type chrome://flags/ in the address bar and hit Enter
  • Enable Insecure origins treated as secure option, and type the IP address of your MiniPupper
  • Restart Chrome

Running on MiniPupper

Run the following command to start a stack of docker images required to perform teleoperation:

docker compose pull && docker compose up -d

An old docker cli uses a bit different syntax: docker-compose up -d.

Open your web browser and go to: http://[MINI_PUPPER_IP_ADDRESS]

Running in simulated environment

If you don't have a robot yet, you can still play with teleoperation locally in a simulated environment.

pupper-sim.mp4

# Required for running Gazebo in container
xhost +local:docker
# Download images
docker compose -f docker-compose-sim.yaml pull
# Run services required for simulation
docker compose -f docker-compose-sim.yaml up -d

Then open your web-browser on a localhost, wait until teleop is ready, and you're good to go.

Building FE and BE

Run the following command on MiniPupper to build FE and BE images:

docker compose build

Local deployment

Install backend dependencies:

cd ./backend && python3 venv .venv
source .venv/bin/activate && pip3 install pip --upgrade && pip3 install -r requirements.txt

Start backend:

./run.sh

Install frontend dependencies:

cd ../frontend && npm install

Prepare .env with required environment variables:

cp .env.example .env

Here are sample values:

REACT_APP_ROSBRIDGE_SERVER_IP=localhost
REACT_APP_ROSBRIDGE_SERVER_PORT=9090
REACT_APP_RECONNECTION_TIMER=1000
REACT_APP_BE_URL=http://localhost:8080
REACT_APP_IS_SIMULATION=true

Start frontend:

npm run start

Go to http://localhost:3000 to see the web UI.

Note that frontend and backend depend on the ROS bridge and a custom teleop node. Make sure you've started them beforehand.

Known issues

In rare cases teleop, smoother and servo nodes can't correctly publish/subscribe to /cmd_vel topic due to registration failure. The current workaround is displayed on the following diagram.

You can try to restart docker images to see if it helps. I couldn't yet found the root cause of these Docker <---> ROS networking issues. Feel free to contact author if you have any idea on how to stabilize it.

Run the following command on MiniPupper to diagnose potential errors in logs:

docker compose logs -f

ToDo

  • Polish FE code
  • Polish BE code
  • Add local deployment instructions
  • Add docker-cross builds
  • Push teleop and mini-pupper core sources
  • Migrate to ROS2
  • Get rid of velocity-smoother, which seems to cause most networking issues
  • Add map for SLAM and navigation
  • Potentially integrate this code into MiniPupper repo