Skip to main content

Wi-Fi RSSI heatmap generation using ROSbot 2.0

Introduction​

Use ROSbot to check the Wi-Fi singal strength in your apartment. This project allows to measure and display RSSI (Received Signal Strength Indication) of given Wi-Fi network in a desired area, as shown in the video below:

Project overview​

Open Source code on GitHub

Wi-Fi RSSI Heatmap Generator is runs on ROSbot 2.0 PRO. It runs on PC and ROSbot, connected over Peer-to-Peer Husarnet VPN network.

ROSbot​

compose.rosbot.yaml file runs composition of various containers. Details about most of them can be found in Docker images page. In this project however we build only one of them: nav2-wifi-heatmap that contains a custom plugin for Nav2, nav2_read_rssi_at_waypoint responsible for measuring rssi and sending it to PC over VPN.

compose.rosbot.yaml
# Quick Start
# $ docker compose -f compose.rosbot.yaml up

version: "2.3"

services:

# ROS Galactic
nav2:
image: nav2:latest
build: ../nav2-wifi-heatmap
restart: unless-stopped
tty: true
command: ros2 launch wifi_heatmap_nav2 bringup_both.launch.py
volumes:
- ~/fakenet_:/fakenet_
environment:
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

# ROS Noetic + ROS 2 Galactic
bridge:
image: ros:galactic-ros1-bridge
restart: unless-stopped
environment:
- ROS_MASTER_URI=http://ros-master:11311
command: ros2 run ros1_bridge dynamic_bridge

# ROS Master (using custom port in case Master is already running on host OS)
ros-master:
image: ros:melodic-ros-core
restart: unless-stopped
command: stdbuf -o L roscore

# ROS Melodic rosbot hardware layer
rosbot:
image: husarion/rosbot
restart: unless-stopped
devices:
- /dev/ttyS4 # must match environment SERIAL_PORT
environment:
- SERIAL_PORT=/dev/ttyS4 # default: ttyS1 - rosbot2.0; ttyS4 - rosbot2.0 `pro
- ROS_MASTER_URI=http://ros-master:11311
command: roslaunch --wait rosbot_description rosbot_docker.launch

# ROS Melodic Rplidar
rplidar:
image: husarion/rplidar:latest
restart: unless-stopped
devices:
- /dev/ttyUSB0
environment:
- ROS_MASTER_URI=http://ros-master:11311
command: roslaunch --wait rplidar_ros rplidar_a3.launch # For Rosbot 2.0 PRO use roslaunch rplidar_ros rplidar_a3.launch

PC​

Containers running on PC (eg. your laptop) provide tools for mapping desired area (using rviz's goal_pose). They also contain mapper_packages which are responsible for defining measurement points based on saved map, receiving RSSI measurement data from ROSbot and generating RSSI heatmaps using 2D interpolation based on received data.

Apart from being used as intended, this project can also serve as a guide on how to:

  • use Husarnet to share data between ROSbot and your PC, which can allow you to develop more complex and demanding applications.
  • create plugins for Nav2 Waypoint Follower, making it easy to change ROSbot's behaviour according to your needs
compose.rosbot.yaml
# Quick Start
# $ xhost local:root
# $ docker compose -f compose.pc.yaml up

version: "2.3"

services:

# ROS Galactic
mappers:
image: mappers
build: ../mapper-packages
restart: unless-stopped
tty: true
volumes:
- /home/s/map:/map
- /home/s/heatmaps:/heatmaps
- /tmp/.X11-unix:/tmp/.X11-unix:rw
environment:
- DISPLAY
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

rviz:
image: husarion/rviz2
restart: unless-stopped
runtime: nvidia
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ./rosbot_pro.rviz:/root/.rviz2/default.rviz
environment:
- DISPLAY
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

Setup​

1. Get Husarnet Join Code

Create a Husarnet network according to this tutorial and find your Join Code allowing you to connect different hosts to the same VPN network.

info

You will find your Husarnet Join Code on your account at Husarnet Dashboard:

  1. Log in to https://app.husarnet.com/
  2. Select or create a network
  3. Click [Add element] button and select a Join Code tab:

Join Code looks like this:

JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

2. Clone contents of this repository to your PC and ROSbot:

git clone https://github.com/husarion/rosbot-demo-wifi-heatmap.git
  1. Create '.env' file inside 'docker-compose' folder and paste your husarnet joincode and generate DDS config files:
    ~~~
    ./generate-vpn-config.sh
    ~~~
    This will create secrets file, which you need to copy to the same directory on another device.
JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

4. Run Docker containers on ROSbot:

Run bash script exposing /proc/net/wireless data to container:

chmod +x rosbot-demo-wifi-heatmap/net_expose.sh
rosbot-demo-wifi-heatmap/net_expose.sh &

Launch containers:

cd rosbot-demo-wifi-heatmap/docker-compose
docker compose -f compose.rosbot.yaml -f compose.rosbot.husarnet.yaml up

4. Run Docker containers on PC:

Run script enabling rviz:

xhost local:root

Launch containers:

cd rosbot-demo-wifi-heatmap/docker-compose
docker compose -f compose.pc.yaml -f compose.pc.husarnet.yaml up

Usage​

Mapping​

At first an appropriate map of dseired area needs to be created using rviz goal pose, which allows user to pass waypoints to robot. While reaching those waypoints ROSbot will map area around it thanks to SLAM toolbox. Several imortant things must be considered while mapping and choosing environment to map:

  • Points too close to obstacles or unknown areas will not be marked as waypoints
  • The less obstacles, the better because ROSbot will be able to measure RSSI in more waypoints, resulting in more accurate heatmap at the end
  • Remember that some obstacles are invisible to ROSbot's lidar for exemple transparent surfaces, or obstacles located under lidar's view

Autonomous heatmap generation​

After desired area is mapped execute following command on your pc will start the process of autonomous measurement:

 docker exec docker-compose-mappers-1 /run.sh

After running this command a map will be displayed with waypoints marked. Green ones are actual waypoints marked for measurement, while the red ones were considered too close to obstacles or unknown areas. Remember that in the areas with less waypoints, data will also be less acurate (less data for interpolation). ROSbot will start going through all green waypoints, measuring RSSI for ten seconds in each one and sending data to a ROS2 node on pc.

Displaying results (the heatmap)​

After all waypoints have been achieved, two heatmaps will be generated based on collected data. Raw images will be saved in /heatmaps folder. For full figures with heatbars use SAVE button in matplotlib GUI and save images in '/heatmaps' directory, which at default is mounted on folder with the same name in your home directory.

Here are the results of running this application:

relative_heatmap absolute_heatmap


by StanisΕ‚aw Dudiak Husarion

Do you need any support with completing this project or have any difficulties with software or hardware? Feel free to describe your thoughts on our community forum: https://community.husarion.com/ or to contact with our support: support@husarion.com