ROS2 Foxy, running on Ubuntu server 20.04 on a Raspberry Pi 4, is employed in controlling a physical 2 wheeled drive vehicle. The vehicle is equipped with an RPLIDAR A1 sensor and an Intel RealSense D415 depth camera used for autonomous driving, obstacle avoidance and Simultaneous Localization and Mapping (SLAM) operations.
(Work in progress)
The following components were used in this project:
Part | |
---|---|
1 | Raspberry Pi 4 (4 GB) |
2 | SanDisk 64 GB SD Card |
3 | Two wheel drive robot chassis kit (with wheel encoders) |
4 | Waveshare Motor Driver HAT |
5 | 2 x Photo interrupters for wheel encoders |
6 | MPU6050 board |
7 | RPLIDAR A1 |
8 | Intel RealSense D415 depth camera |
9 | 3D printed stands for RPLIDAR A1 and RPi 4 |
10 | Mount for D415 depth camera |
11 | Powerbank for RPi 4 (minimum output: 5V 3A) |
12 | 3 Slot 18650 battery holder |
13 | 3 x 18650 batteries to power Motor Driver HAT |
14 | Female to Female Dupoint jumper cables |
15 | Spare wires |
16 | On/Off switch (included in robot chassis kit) |
Some other tools or parts used in the project are as follows:
Tool/Part | |
---|---|
1 | Soldering iron |
2 | 3D printer |
3 | Screwdriver set |
4 | Double-sided tape |
The electronic components of the lidarbot are connected as shown below.
The MPU6050 board pins were connected to the Raspberry Pi 4 GPIO pins as follows:
MPU6050 board | GPIO.BOARD | GPIO.BCM |
---|---|---|
VCC | 3.3V | 3.3V |
GND | GND | GND |
SCL | 05 | GPIO03 |
SDA | 03 | GPIO02 |
The right and left photo interrupter sensors are connected to GPIO pins as follows:
Photo interrupter (R) | GPIO.BOARD | GPIO.BCM |
---|---|---|
OUT | 18 | GPIO24 |
VCC | 5V | 5V |
GND | GND | GND |
Photo interrupter (L) | GPIO.BOARD | GPIO.BCM |
---|---|---|
OUT | 22 | GPIO25 |
VCC | 5V | 5V |
GND | GND | GND |
The screw terminal blocks on the Motor Driver HAT (shown below) are connected to the motor wires and battery holder cables as follows:
Motor Driver HAT pin | Connected to |
---|---|
MA1 | Red wire (Left motor) |
MA2 | Black wire (Left motor) |
GND | Black wire (battery holder) |
VIN | Red wire (battery holder) |
MB1 | Red wire(Right motor) |
MB2 | Black wire (Right motor) |
Solder the cables (provided) to the motors. Might need to use spare wires if the provided ones are too short to reach the motor hat. Should the wheel(s) move in the direction opposite of what is expected, exchange the respective motor cables screwed into the terminal blocks.
Finally, the RPLIDAR A1 sensor and the Intel RealSense D415 depth camera are plugged into the USB ports of the Raspberry Pi 4.
ros2 run real_lidarbot motor_test.py
ros2 run real_lidarbot encoder_test.py
Run on host machine:
ros2 run joy joy_node
Run on remote machine/lidarbot:
ros2 run real_lidarbot joystick_test.py
Run on host machine:
ros2 run joy joy_node
Run on remote machine/lidarbot:
ros2 launch real_lidarbot odometry_launch.py
and
ros2 run real_lidarbot go_to_goal_node.py --ros-args -p coordinate_pairs:=2 \
-p coordinates:='[0.5, 0.5, 0.0, 0.0]'
Run on host machine:
ros2 run joy joy_node
Run on remote machine/lidarbot:
ros2 launch real_lidarbot odometry_launch.py
and
ros2 run real_lidarbot go_to_goal_node.py --ros-args -p coordinate_pairs:=4 \
-p coordinates:='[0.8, 0.0, 0.8, 0.8, 0.0, 0.8, 0.0, 0.0]'
Gazebo | RViz |
---|---|