Giter VIP home page Giter VIP logo

robo-perception's Introduction

RoboPerception

This project enables web-based teleoperation support for different types of robots like MiniPupper. Video streaming is implemented via WebRTC, and teleoperation is done via ROS. Note that the backend expects you've already connected a depth camera like OAK-D Lite to your robot (only Luxonis products are supported at the moment). If you don't have one yet, you can still teleoperate the robot via keyboard w/o a video stream, or just use a simulator (guide TBD).

rp_demo_cut1.mp4

Architecture

The following diagram reflects the most recent implementation:

RoboticsDiagram

  • backend: Python BE, which streams camera video to the remote browser via WebRTC; it internally uses DepthAI API on real hardware, and Gazebo camera images in simulation mode;
  • frontend: ReactJS FE which uses roslibjs to communicate with ROS bridge and WebRTC API for camera streaming;
  • rosbridge: WS proxy between FE/BE and ROS that handles the following messages.
Source Pub/Sub Topic Message Type Example
FE Pub /key std_msgs/String i/I/1/,
FE Pub /robot_pose/change std_msgs/String sit/stand
FE Sub /teleop_status std_msgs/Bool true/false
FE Sub /robot_pose/is_standing std_msgs/Bool true/false
FE Sub /battery/state sensor_msgs/BatteryState
FE Sub /memory/state std_msgs/Float32 0.0-100.0
FE Sub /cpu/state std_msgs/Float32 0.0-100.0
BE Sub /camera/color/image_raw/compressed sensor_msgs/CompressedImage
  • ROS Bridge should be visible to a client to perform common operations via Web UI.
  • You should provide CompressedImage to see a virtual camera stream from Gazebo in simulation mode.
  • Only BatteryState.percentage property is used for rendering for battery stats.
  • Teleoperation is impossible while is_standing or teleop_status flag is false.
  • Keyboard keys are sent in a raw format. You should implement ROS subscriber which transforms a key to cmd_vel.
  • /robot_pose/change is very robot-specific: FE just sends either a sit or stand command.

Installation

Clone the source code:

git clone https://github.com/WaverleySoftware/robo-perception.git && cd robo-perception

Prepare required env files:

./generate_configs.sh [ROBOT_IP_ADDRESS]

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

Setup backend:

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

Setup frontend:

cd ../frontend
npm install

Running

Start ROS bridge and all the custom ROS services that implement the message protocol described in architecture section.

Start backend:

cd robo-perception/backend && source .venv/bin/activate
./run.sh

Start frontend:

cd robo-perception/frontend && npm start

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

Building FE and BE Docker images

Run the following command to build FE and BE images:

docker compose build

ToDo

  • Polish FE and BE code
  • Add local deployment instructions
  • Add simulated environment instructions
  • Add Docker instructions
  • Migrate to ROS2
  • Add interactive map for SLAM and navigation
  • Add gamepad support

robo-perception's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

robo-perception's Issues

Replace hardcoded settings with BE calls

Robot settings and widgets should be fetched from BE. Endpoints are already in #47 branch + FE API. It's the matter of changing the Settings and all the relative components.

Add an ability to reset robot's pose in simulator mode

This feature is for testing purposes.

Currently, if the robot is turned upside down, you need to restart robotics server to reset the robot's pose.

It'd be nice to have a functionality of resetting robot's pose directly from UI.

Disabling / enabling the 'Screen' widget stops streaming

Branch: GH-47-add-missing-ros-events
Mode: simulator

STR:

  1. Open FE app in the browser app
  2. Close video widget
  3. Switch to Settings tab
  4. Enable video widget by clicking on the 'Screen' toggle
  5. Click on 'Play' icon

Actual result: video stream hasn't started and there are no errors in the console.
Expected result: it should be possible to start stream.

STR:

  1. 1Open FE app in the browser app
  2. Start streaming by clicking on 'Play' icon
  3. Close video widget
  4. Pay attention to the console logs
  5. Switch to Settings tab
  6. Enable video widget by clicking on the 'Screen' toggle
  7. Click on 'Play' icon

Actual result: video stream hasn't started and the following errors've appeared in the console:

Uncaught TypeError: Cannot set properties of null (setting 'srcObject') index.js:108 
    at VideoPlayer.<anonymous> (index.js:108:1)
    at executeAction (action.ts:68:1)
    at VideoPlayer.setVideoSource (action.ts:49:1)
    at index.js:92:1

Expected result: the playback should continue.

image

Add missing ROS events

As we already have the main widgets implemented, it's required to add the following ROS event handlers:

  • battery state
  • CPU state
  • RAM state
  • pose changes: sit/stand

Renaming the robot doesn't work

Branch: GH-47-add-missing-ros-events
Mode: simulator

STR:

  1. Switch to the Settings tab
  2. Edit robot's name by pressing any character on the keyboard or delete key

Actual result: it's impossible to edit the name
Expected result: it should be possible to rename the robot.

image

Nothing happens by pressing Shift + any key

Branch: main
Mode: simulator

STR:

  1. Open app in the browser
  2. Click on 'Play' icon to start streaming
  3. Pressing Shift + any key that mapped to the movement

Actual result: nothing has happened.
Expected result: the associated movement should be initialized.

Update the flow of switching to another robot

Note: this ticket requires the design for the warning popup.

When the user selects another robot Y in the header
And there is already active connection to the current robot
Then the warning popup should be opened with the msg that the connection with robot X will be interrupted and smth like 'Are you sure?'
When the user clicks on 'Yes'
Then the current connection is closed
And the dashboard page opens with the widgets view for the chosen robot - #67
And the robot Y is connected

image

refactor FE code

  • delete serviceworker
  • delete useClickPreventionOnDoubleClick custom hook

'Detect objects' shouldn't start streaming

STR:

  1. Open an app in the browser.
    Note: the stream hasn't been started, and now the page is opened in the initial state.
  2. Enable 'Detect objects' by clicking on toggle

Actual result: the streaming has started
Expected result:

  • the streaming shouldn't be started by enabling 'detect objects'.
  • the streaming should be started only by clicking on 'Play' icon.
  • if the user enables 'detect objects' mode and then clicks on 'Play', the streaming should be started in the detect objects mode.
Screen.Recording.2023-01-23.at.12.49.19.mov

[FE] BE_URL - Delete empty space between host and port

BE_URL has the wrong value, cuz REACT_APP_BE_URL might be imported with one extra space in the end of the string.

Branch: GH-47-add-missing-ros-events

STR:

  1. Open FE app in the browser
  2. Click on 'Play' icon

Actual result: the following request is failed:

method: POST
url: `${BE_URL}/offer`

image

Expected result: URL should be valid and request should pass successfully

Update README

Add more detailed instructions based on the recent updates.

Background doesn't stretch properly

Branch: GH-47-add-missing-ros-events

STR:

  1. Open app in the browser (Chrome)
  2. Resize the browser window to less than 1390px in width
  3. Scroll right horizontally

Actual result: background doesn't cover the whole body.
Expected result: background should stretch accordingly to the width of the browser tab

Screenshot 2023-01-19 at 14 23 04

Settings | Widgets should be robot-dependent

Currently, the user can customize widgets in general and that view state is displayed for all robots.
However, some robots may not have Video camera and as a result, the Screen widget is unnecessary. Or another example, the user don't want to see 'Robot's speed' widget on the main page for one robot, but it's required for another one.

Thus, it should be possible to configure widgets for each robot separately.

Note: it may require updates on UI and in designs by merging Widgets settings with the main robot's settings.

Screenshot 2023-04-10 at 14 12 33

Fix wrong and missleading keyboard icons

See the following videos to get the idea of what's going on at the moment:

pupper_poses_1_1.mp4

pupper_poses_2_1.mp4

Here are the issues:

  • [6] should look down
  • [d-f] should be on [a-s] place, and [d-f] should have icons that reflect head/tail movement up and down
  • It's not clear what's the difference between [3-4] and [d-f] icons (see the second video for details).

That's how it works on a hardware level:

  • [3-4] moves the body horizontally while the legs are moved diagonally to the left and right
  • [a-s] moves the body around the X-axis while the legs aren't moved.

So the fact that we don't display legs on the icons leads to confusion.

Add handling case of the interrupted connection with BE

STR:

  1. Run the project: robo part, BE and FE
  2. Open an application in the browser
  3. Click on 'Play' icon to start streaming
  4. Stop BE in the terminal
  5. Return to the browser's tab.

Actual result: the stream process is still visually in progress, but in fact the connection with the server was interrupted.
Expected result: TBD show the spinner with attempts to reconnect and stop the process after N attempts.

image

UI for joystick

Create UI and listener for joystick so that user could operate robot not only via keyboard

Expand the selected robot's settings by default

Currently, the settings of the 1st robot from the list are always open by default. It would be better to expand the settings of the selected robot when a user opens the Settings tab.

STR:

  1. Open an app in the browser
  2. Select any robot except the 1st one in the header's list
  3. Switch to the Settings tab

Actual result: the settings of the 1st robot from the list are open, but at the same time another robot is active.
Expected result: the settings of the chosen (active) robot should be expanded.

Note: Need to also discuss the behaviour if the settings tab is already open and a user switches to another robot in the header:

  • smooth animation of collapsing / expanding?
  • there are unsaved changes in the current expanded robot's settings?

image

'Caps lock' state collision

Need to investigate how we can detect the activated / deactivated Caps lock mode on the keyboard and sync states when a user returns to the application tab.
STR:

  1. Open an app in the browser
  2. Enable Caps lock mode on the keyboard
  3. Switch to any other application to make our robo app inactive
  4. Press Caps lock on the keyboard
  5. Return to the browser tab with our app
  6. Press navigation key on the keyboard

Actual result: the Caps lock mode is still highlighted on the UI keyboard, but it's already disabled on the real keyboard. As a result, when the user presses any mapped key on the keyboard, there is a collision in the movements.
Expected result: the caps lock UI state should be sync with the current state on the keyboard when a user returns to the application tab and press the mapped key on the keyboard.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.