This project is based on mangdangroboticsclub/mini_pupper_ros. Please refer to this work for installation and basic usage.
Additional work and features will be detailed here, please refer to the different section.
This face detection use Facenet on Pytorch using a camera. The detection are published on the topic /detected_faces
The device used for face detection is recommended to be a remote one, not necessarily Mini Pupper. Run camera launch file or robot bringup on device with camera:
ros2 launch mini_pupper_driver camera.launch.py
or
ros2 launch mini_pupper_bringup bringup.launch.py
Run the face detection on the device of your choice that can access ROS2 topics.
First download facenet-pytorch:
pip install facenet-pytorch
Then run the face detection:
ros2 launch mini_pupper_recognition face_recognition.launch.py
A rqt plugin has been added to monitor and visualize the detections:
- In rqt, go to Plugins/Debugging/Image Overlay
- The image from camera should be displayed with topic /image_raw
- Add an overlay by pressing + button
- Choose vision_msgs/msg/Detection2DArray
- Add topic name /detected_faces
The display of images or videos is made via ros2 topic.
Run the subscriber linked to the display logic on the Mini Pupper with:
ros2 launch mini_pupper_driver display_interface.launch.py
On remote device run publisher and indicate the path of the media (png, jpg, gif, mp4):
ros2 run media_publisher media_sender_node path/to/media.png
The screen on Mini Pupper should display the media
Explanation and behavior
The subscriber use by default CompressedImage as message type. The publisher uses Image Transport package to handle transport type smoothly. It means it will adapt the message type to the topic listening message type.
Currently the only way to change compressed images to raw images is to change logic in the python display interface launched on Mini Pupper:
self.sub = self.create_subscription(CompressedImage, 'mini_pupper_lcd/image/compressed', self.callback, 10)
# Replace by this subscriber if image not compressed needed
#self.sub = self.create_subscription(Image, 'mini_pupper_lcd/image/raw', self.callback, 10)