Project Overview
This subproject tends to use Ultrasonic sensors or further with Lidar detector to implement distance detection function on JetBot 2GB AI Kit. Aiming to detect the distance between the differential drive robot and the obstacles, and providing the data to avoid obstructions. Using HC-SR04 Ultrasonic Distance Sensor, paired with an Arduino Uno and the Arduino library, rosserial.h, to act as a bridge between the hardware and the ROS network that our robot’s algorithms are running on.
Distance detection by Ultrasonic sensor and Lidar
For anyone who wants to use the ultrasonic sensor with the jetson nano robot using ROS. Thay can follow the detailed instructions below.
Components/ Purchase List
- Arduino Uno
- HC-SR04 Ultrasonic Distance Sensor
- JetBot 2GB AI Kit
- RPLIDAR A1M8 2D 360 Degree LIDAR Sensor
Work through this tutorial: Simple Ultrasonic Distance Measurer With LCD Display.This tutorial will teach you how to get started with HC-SR04 Ultrasonic in Arduino. This tutorial is the very basic building block for the rest of the project.
Here, follow the codes below to install the ROS on JetBot.
If you meet problems, make sure you have checked the ROS has successfully installed in the JetBot. Then try following codes.
Using terminal to type following commands and stream the data.
Step 1 : Open a terminal and type arduino (DO NOT CLOSE THE TERMINAL)
Step 2 : In Arduino, go to file-open-SingleUltrasonic in the sketch and upload the sketch. Code is here.
Step 3 : Open a new terminal and type the command roscore (DO NOT CLOSE THE TERMINAL)
Step 4 : Open another new terminal to access Jetson Nano USB ports for Serial Communication and type the the command (DO NOT CLOSE THE TERMINAL) rosrun rosserial_python serial_node.py /dev/(your port)
Step 5 : Open another new terminal to access Jetson Nano USB ports for Serial Communication and type the below command (DO NOT CLOSE THE TERMINAL) rostopic echo chatter
Connect the RPLIDAR A1M8 2D 360 Degree LIDAR Sensor with JetBot. Then initiate the software to detect the 360 degree environment with higher accuracy.
Processure
These are the levels that you need to achieve so that you can realize the function.
The working principle of how to use ROS to convert the data.
You can learn the structure of the ultrasonic and the principle of detection. Then get to know how to use ROS connect with Arduino.
You need to control the ultrasonic sensor through Arduino Uno.
You can integrate the ultrasonic sensor into ROS system. Be assure the data can be transfered from Arduino to ROS. Also, make sure the data can be published and other part can get the data like the video shows.
With further increasing the accuracy of detecting the environment and assisting the driving. Using LiDAR sensor system to detect obstacles and collect data .
Demonstrations
Here is the demonstration of using HC-SR04 ultrasonic sensor to collect data and transfer it through ROS.
When we want to increase the accuracy of the detection. We change the Ultrasonic sensor to Lidar sensor, which can detect 360-degree views with higher measurement accuracy
Here we demonstrate the recognition of basic images. As you can see, the images showing on the Lidar is vivid and precise.
When we implement the Lidar and apply it in the real world. It shows a good fit to the working area in the picture, which means we can integrate the Lidar sensor with our diffdrive robot to realize 360-degree real-time imaging.
Future work
- Attempt to integrate the Lidar into the robot and control it through ROSserial
- Make sure other subscribers can get the data