Person Following
To set this up and make it work you need to first follow the instructions in the repository. Next, you need a basic understanding of how the package functions. The idea is to use a depth camera to detect people. For this, I'm using the YOLO ROS package, which detects people effectively.
However, the depth data from the camera can be noisy and occasionally inaccurate. To address this, I'm using a LiDAR sensor to detect people using the DBSCAN clustering model from scikit-learn
. This allows me to identify elongated clusters of LiDAR points and classify them as walls, while also detecting smaller, circular clusters as people.
A separate node processes these two data sources and determines which person detected by YOLO corresponds to which cluster in the LiDAR data. Once this association is made, the robot must avoid collisions with both walls and people while following the target. This is done using the LiDAR sensor to stop the robot if something gets too close or to steer slightly away if it begins approaching a wall.
Node layout
The package consists of a launch file and three main Python nodes that process the data:
camera_lidar_fusion.py
This node takes data from the YOLO ROS node and the LiDAR object detection node. It correlates the inputs to determine which LiDAR points are associated with detected people, and decides which one to follow. The selected target is published on the selected_lidar_object
topic.
lidar_object_detection.py
This node receives data from the LiDAR sensor and uses AI models to detect people. The detected objects are published to the lidar_objects
topic.
yolo_person_detection.py
This node subscribes to the selected_lidar_object
topic and drives the robot toward the selected target. It also handles obstacle detection to prevent collisions with walls or people who get too close.
Running Package
After installing all the requirements it is now time to run the package. You can change he sensor topics and toggle the visualizations in the follow_person.launch.py
. Here a a few sample commands to run this script and follow people.
Basic follow person command:
Basic command with custom namespace:
ros2 launch person_follower_bringup follow_person.launch.py namespace:=a200_0934 follow_default:=true
Basic command with custom max follow speed:
Note: The
follow_default
parameter tells the package whether to follow by default or wait for atrue
to be published on thefollow_person
topic.