Click the image above to access the project report
Keywords
Particle filter, Localisation, Hardware Acceleration, Teensy 4.1, UPduino v3.1
Table of Contents
Localisation is a fundamental prerequisite to any meaningful application within the context of robotics. One powerful method for localisation, known as particle filtering, is becoming more and more popular. While particle filtering remains less computationally complex than alternative methods such as Kalman filtering, the ability of a particle filter to accurately and quickly estimate robot pose is directly proportional to the number of particles. This is particularly concerning given that there is an increasing need for particle filters to run in demanding and constrained environments. Consequently, particle filtering methods are required to be fast and efficient under various conditions to allow for scalable implementations in hardware-constrained environments. Since FPGAs and microcontrollers are widely used in various domains, characterisation of the accelerated and non-accelerated per-particle efficiency and performance, in terms of power usage, memory usage, and execution time per sample could serve as a useful guide for future applications. Through this study, it is shown that hardware acceleration should be considered the preferred solution when there is a need for high performance and energy efficiency. It is however noted that the viability of hardware acceleration is dependent on the required map size and resolution. Finally, it is concluded that no value is offered by hardware acceleration for unconstrained applications where high sampling rates are not required.
Detailed here is the equipment you need to run the provided code and example experiments
The two components used for the study are the Teensy 4.1 and the UPduino v3.1. The Teensy 4.1 is a microcontroller that is based on the ARM Cortex M7 processor. The UPduino v3.1 is an FPGA development board that is based on the Lattice iCE40 UltraPlus FPGA. The following table provides a summary of the specifications of the two components.
Component | Teensy 4.1 | UPduino v3.1 |
---|---|---|
Processor | ARM Cortex M7 | Lattice iCE40 UltraPlus FPGA |
Clock Speed | 600 MHz | 48 MHz |
Memory | 1 MB | 256 KB |
Flash Memory | 2 MB | 256 KB |
GPIO Pins | 34 | 64 |
Power | 5 V | 3.3 V |
The following software is required to run the code and experiments.
- Install the required software needed to run the simulation.
-
Ubuntu 22.04
-
ROS2 Humble
Install ROS2 Humble following the instructions here.
Run the following commands to install Webots 2022a after downloading the .deb file:
sudo apt install ./webots_2022a_amd64.deb
There is a known cirtificate issue with the Webots installation. To fix this, follow the instructions here.
- Numpy
sudo apt-get install python3-numpy
- Build the neccessary ROS2 packages
Clone the repository:
git clone --recurse-submodules -j8 https://github.com/matthew-william-lock/teensy-vs-upduino-particle-filter
Move the ROS2 packages into the src
folder of your ROS2 workspace:
cp -r teensy-vs-upduino-particle-filter/src/mcl ~/ros2_ws/src/
cp -r teensy-vs-upduino-particle-filter/src/webots_ros2 ~/ros2_ws/src/
Build the ROS2 packages:
cd ~/ros2_ws
colcon build
If you encounter an error related to "hardware_interface_DIR", try running the following command:
sudo apt install ros-humble-ros2-control
mcl
package found in src. This is important and the simulation will not work otherwise as you will have not installed the necessary dependencies.
Source the ROS2 workspace:
source ~/ros2_ws/install/local_setup.bash
Show here is documentation of how to run the three experiments that were run for this investigation. Shown in the video below is the pure Python implementation without any embedded localisation (i.e. without the Teensy or Upduino). This base case simulation is extended from Debby Nirwan.
2023-02-08.21-55-53.mp4
All of the instructions below assume you have already installed the required software described in the Getting Started section.
Localisation here is perfomed on the host machine using the Python implementation of the particle filter. The following command is used to run the simulation:
ros2 launch mcl mcl_launch.py rviz:=true mission_time:=2
Parameters:
Parameter | Description |
---|---|
rviz | Whether to run RViz or not. |
mission_time | The time in minutes. |
Localisation here is perfomed on the Teensy 4.1 microcontroller. Before running the simulation, the code must be uploaded to the Teensy 4.1 and your host machine must be running micro-ROS as described in the here.
The following command is used to run the simulation:
ros2 launch mcl mcl_teensy_launch.py rviz:=true mission_time:=2
Parameters:
Parameter | Description |
---|---|
rviz | Whether to run RViz or not. |
mission_time | The time in minutes. |
Acceleration is achieved by using the FPGA accelerator, the experimental setup of which is described here. To toggle acceleration, this must be set in the mcl config file on the Teensy 4.1. Do not forget to recomplie the code and upload it to the Teensy 4.1. Parameters of the configuration file are described below:
Parameter | Description |
---|---|
USE_HARDWARE_ACCELERATION | Whether to use the FPGA accelerator or not |
NUM_OF_PARTICLES | The number of particles to use in the particle filter. |
Below are some links to other tools and development guides that we found useful during the development of this project.