Skip to content

husarion/rosbot_autonomy_ros

Repository files navigation

rosbot-autonomy

Autonomous navigation & mapping for ROSbot 2R / 2 PRO with a web user interface powered by Foxglove. Works over the Internet thanks to Husarnet VPN

autonomy-result

Note

There are two setups on two separate branchers available

branch name description
ros2router Running ROS 2 containers on ROSbot and on PC with the interface in RViz
foxglove Running ROS 2 containers only on ROSbot with a web user interface powered by Foxglove

Quick start (Physical ROSbot)

Note

To simplify the execution of this project, we are utilizing just.

Install it with:

curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/bin

To see all available commands just run just:

husarion@rosbot2r:~/rosbot-autonomy$ just
Available recipes:
    connect-husarnet joincode hostname # connect to Husarnet VPN network
    flash-firmware     # flash the proper firmware for STM32 microcontroller in ROSbot 2R / 2 PRO
    start-rosbot       # start ROSbot 2R / 2 PRO autonomy containers
    start-gazebo-sim   # start the Gazebo simulation
    start-webots-sim   # start the Webots simulation
    restart-navigation # Restart the Nav2 container
    sync hostname password="husarion" # Copy repo content to remote host with 'rsync' and watch for changes

🌎 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. Run in the linux terminal on your PC:

    cd rosbot-autonomy/ # remember to run all "just" commands in the repo root folder
    export JOINCODE=<PASTE_YOUR_JOIN_CODE_HERE>
    just connect-husarnet $JOINCODE my-laptop
  3. Run in the linux terminal of your ROSbot:

    export JOINCODE=<PASTE_YOUR_JOIN_CODE_HERE>
    sudo husarnet join $JOINCODE rosbot2r

    note that rosbot2r is a default ROSbot hostname used in this project

📡 Step 2: Sync

This repository contains the Docker Compose setup for ROSbot 2R and 2 PRO. You can clone it to both PC and ROSbot, or use the just sync script to clone it to your PC and keep it synchronized with the robot

just sync rosbot2r

Note

This just sync script locks the terminal and synchronizes online all changes made locally on the robot. rosbot2r is the name of device set in Husarnet.

🔧 Step 3: Verifying User Configuration

To ensure proper user configuration, review the content of the .env file and select the appropriate configuration (the default options should be suitable).

  • LIDAR_BAUDRATE - depend on mounted LiDAR,
  • MECANUM - wheel type,
  • SLAM - choose between mapping and localization modes,
  • SAVE_MAP_PERIOD - period of time for autosave map (set 0 to disable),
  • CONTROLLER - choose the navigation controller type,

🤖 Step 4: Running Navigation & Mapping

  1. Connect to the ROSbot.

    ssh husarion@rosbot2r
    cd rosbot-autonomy

Note

rosbot2r is the name of device set in Husarnet.

  1. Flashing the ROSbot's firmware.

    To flash the Micro-ROS based firmware for STM32F4 microcontroller responsible for low-level functionalities of ROSbot 2, 2R and 2 PRO, execute in the ROSbot's shell:

    just flash-firmware
  2. Running autonomy on ROSbot.

    just start-rosbot

🚗 Step 5: Control the ROSbot from a Web Browser

Open the Google Chrome browser on your laptop and navigate to:

http://rosbot2r:8080/ui

Note

rosbot2r is the name of device set in Husarnet.


Simulation

Important

To run Gazebo or Webots Simulators you have to use computer with NVIDIA GPU and the NVIDIA Container Toolkit installed.

If you don't have a physical ROSbot 2R / 2 PRO you can run this project in a simulation environment.

Gazebo

  1. To start Gazebo simulation run:

    just start-gazebo-sim
  2. Then open the Google Chrome browser on your laptop and navigate to: http://localhost:8080/ui

Webots

  1. To start Webots simulation run:

    just start-webots-sim
  2. Then open the Google Chrome browser on your laptop and navigate to: http://localhost:8080/ui


Note

Due to efficiency and official manufacturer support, it is recommended to use foxglove-websocket. When using rosbridge-websocket, it is necessary to edit Custom Layers to visualize the robot mesh.

About

Autonomy for ROSbot 3 and ROSbot XL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •