GithubHelp home page GithubHelp logo

dominikn / rosbot-telepresence Goto Github PK

View Code? Open in Web Editor NEW

This project forked from husarion/rosbot-telepresence

0.0 0.0 0.0 1.7 MB

Real-Time Internet Control and Video Streaming with ROSbot 2R / 2 PRO

License: Apache License 2.0

Shell 100.00%

rosbot-telepresence's Introduction

rosbot-telepresence

Manual ROSbot Driving over the Internet with Real-Time Camera Feed

ROSbot ROS2 user interface

There are two different setups on two separate branches:

Quick start

๐ŸŒŽ Step 1: Connecting ROSbot and Laptop over VPN

Ensure that both ROSbot 2R (or ROSbot 2 PRO) and your laptop are linked to the same Husarnet VPN network. If they are not follow these steps:

  1. Setup a free account at app.husarnet.com, create a new Husarnet network, click the [Add element] button and copy the code from the Join Code tab.

  2. Connect your laptop to the Husarnet network. If you are Ubuntu user, just run:

    curl https://install.husarnet.com/install.sh | sudo bash

    and connect to the Husarnet network with:

    sudo husarnet join <paste-join-code-here>
  3. Connect your ROSbot to the Husarnet network. Husarnet is already pre-installed so just run:

    sudo husarnet join <paste-join-code-here> rosbot2r

    note that rosbot2r is a default ROSbot hostname used in this project. If you want to change it, edit the .env file

๐Ÿ“ Step 2: Cloning the Repo

This repository contains the Docker Compose setup for both PC and ROSbot. You can clone it to both PC and ROSbot, or use the ./sync_with_rosbot.sh script to clone it to your PC and keep it synchronized with the robot

git clone https://github.com/husarion/rosbot-telepresence
cd rosbot-telepresence
export ROSBOT_HOSTNAME=rosbot2r # Replace with your own Husarnet hostname
./sync_with_rosbot.sh $ROSBOT_HOSTNAME

Edit .env file and write down the ROSbot 2R Husarnet hostname here to let the PC part know how to find the ROSbot 2R.

ROBOT_NAMESPACE=rosbot2r

๐Ÿ’ป Step 3: Launching the Control Interface on PC

At first start the ROS 2 Router:

docker compose -f compose.pc.yaml up ros2router -d

And run rviz2 and teleop_twist_keyboard directly on the host OS or in Docker (choose one option):

Docker

  1. Running rviz2:

    xhost +local:docker && \
    docker compose -f compose.pc.yaml up rviz
  2. Running teleop_twist_keyboard:

    docker compose -f compose.pc.yaml run --rm -it rviz ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/rosbot2r

Host

  1. Running rviz2:

Note

You need to install image-transport-plugins package first:

sudo apt install ros-$ROS_DISTRO-image-transport-plugins
export FASTRTPS_DEFAULT_PROFILES_FILE=$(pwd)/shm-only.xml
rviz2 -d ./params/default.rviz
  1. Running teleop_twist_keyboard:

    export FASTRTPS_DEFAULT_PROFILES_FILE=$(pwd)/shm-only.xml
    ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/rosbot2r

โš™๏ธ Step 4: Flashing the ROSbot Firmware

SSH to the ROSbot's shell:

ssh husarion@$ROSBOT_HOSTNAME

and execute:

./flash_rosbot_firmware.sh

๐Ÿค– Step 5: Launching the Containers on ROSbot

docker compose up

Useful tips

1. Checking a datarate

To assess the data rate of a video stream being transmitted over the Husarnet VPN (which appears in your OS as the hnet0 network interface), execute the following:

husarion@rosbot:~$ ifstat -i hnet0
      wlan0
 KB/s in  KB/s out
    6.83   2744.66
    1.67   2659.88
    1.02   2748.40
    6.73   2565.20
    1.02   2748.65
    1.18   2749.64

2. Sending uncompressed video frames over the network

If raw image data is being transmitted over the network, you need to perform some DDS-tunning (both on ROSbot and PC):

For configs in LAN:

sudo sysctl -w net.ipv4.ipfrag_time=3 # 3s
sudo sysctl -w net.ipv4.ipfrag_high_thresh=134217728 # (128 MB)

For configs over VPN:

sudo sysctl -w net.ipv6.ip6frag_time=3 # 3s
sudo sysctl -w net.ipv6.ip6frag_high_thresh=134217728 # (128 MB)

3. Using Logitech F710 gamepad

Rather than employing the teleop_twist_keyboard ROS 2 package, you have the option to use the Logitech F710 gamepad. To utilize it, plug it into your PC's USB port and launch the joy2twist container on your PC:

docker compose -f compose.pc.yaml up joy2twist

ROSbot control with gamepad

Troubleshooting

Packet was not a Theora header warning

The log from your computer where you launched compose.pc.yaml may contain the following message:

[WARN] [1704479601.591809892] [rviz]: [theora] Packet was not a Theora header

Due to an issue in the theora codec, headers are probably sent only at the start. If you've initiated compose.pc.yaml following compose.yaml, it's essential to restart the astra service on ROSbot.

To do so, execute in the ROSbot's terminal in the /home/husarion/rosbot-telepresence folder the following line:

docker compose restart astra

rosbot-telepresence's People

Contributors

dominikn avatar janbrzyk avatar rafal-gorecki avatar

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.