Skip to main content

Autonomous Navigation & Mapping with Foxglove and ROSbot XL

This project will show you how to run autonomous navigation & mapping on ROSbot XL with a web user interface powered by Foxglove. It works both in LAN and over the Internet thanks to Husarnet VPN.

The whole setup runs in Docker and you can easily add your own ROS 2 Nodes to that system. Treat this as a template project that you will use with ROSbot XL when you need mapping and autonomous driving with a web user interface.

Requirements

You need ROSbot XL mobile robot equipped with the RPLIDAR A2/A3/S2/S3 LIDAR. You can get the whole set from our online store.

ROSbot XL with LIDAR

Ensure you have your ROSbot XL connected to the Wi-Fi network and that you have the access to it's terminal over the SSH connection. You will find the instructions how to do that in the ROSbot XL Quick Start Guide.

Quick start (Physical ROSbot)

Start with clonning the GitHub repository with the project sources to your PC or directly to ROSbot XL and switch to the foxglove branch:

git clone https://github.com/husarion/rosbot-xl-autonomy.git
git checkout foxglove
note

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

Install just 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@rosbotxl:~/rosbot-xl-autonomy$ just
Available recipes:
connect-husarnet joincode hostname # connect to Husarnet VPN network
sync hostname="${ROBOT_NAMESPACE}" password="husarion" # Copy repo content to remote host with 'rsync' and watch for changes
flash-firmware # flash the proper firmware for STM32 microcontroller in ROSbot XL
start-rosbot # start containers on a physical ROSbot XL
start-simulation engine="gazebo" # start the simulation (available options: gazebo, webots)
restart-navigation # Restart the Nav2 container

🌎 Step 1: Connecting ROSbot and Laptop over VPN (optional)

Ensure that both ROSbot XL and your laptop are linked to the same Husarnet VPN network if you want to access the Web User interface over the Internet. 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-xl-telepresence/ # 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 rosbotxl
tip

rosbotxl is a default ROSbot hostname in Husarnet VPN used in this project. In the further steps you can use this hostname to access the robot's web UI

📡 Step 2: Sync

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 (rsync will send all cheanges from your PC to ROSbot XL file system under the path /home/husarion/rosbot-xl-autonomy automatically).

just sync rosbotxl
info

This just sync script locks the terminal and synchronizes online all changes made locally on the robot. rosbotxl 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 (if not already connected).

    ssh husarion@rosbotxl
    cd rosbot-xl-autonomy
tip

rosbotxl is a default ROSbot hostname in Husarnet VPN used in this project. In the further steps you can use this hostname to access the robot's web UI

  1. Flashing the ROSbot's firmware.

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

    just flash-firmware
    # or "just flash"
  2. Running autonomy on ROSbot XL.

    just start-rosbot
    # or "just rosbot"

launching nav2 and Foxglove on ROSbot XL

🚗 Step 5: Controlling the ROSbot from a Web Browser

Open the Google Chrome browser on your laptop and open the URL:

http://rosbotxl:8080/ui

tip

rosbotxl is a default ROSbot hostname in Husarnet VPN used in this project.

Foxglove web user interface


Simulation

tip

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 XL you can run this project in a simulation environment.

ROSbot XL running in Gazebo with Foxglove Web UI

Select the Simulator

Gazebo

To start Gazebo simulation run:

just start-simulation gazebo
# or "just gazebo"

Webots

To start Webots simulation run:

just start-simulation webots
# or "just webots"

Open Web UI

Then open the Google Chrome browser on your laptop and navigate to: http://localhost:8080/ui