This project configures an AI robot arm to generate the Semantic Robot Description Format (SRDF) file using MoveIt Setup Assistant. The robot can detect the mouth of a person from a live video stream. It was originally planned to be a robot feeding arm. However, the 2D camera used was unable to sense the distance to the face.
Setting up the Software Platform and HardwareFollow the website https://github.com/amd/Kria-RoboticsAI to set up the SD Card image, install PYNQ and install ROS2.
1. Dowload the iot-limerick-kria-classic-desktop-2204-x07-20230302-63.img.xz image and write it onto the SD Card.
2. Boot the SD Card in the Starter Kit.
3. Issue the commands:
$ sudo date -s "yyyy-mm-dd hh:mm:ss"
$ sudo apt update
$ sudo apt install dos2unix
$ sudo snap install xlnx-config --classic --channel=2.x
4. Download the install_update_kr260_to_vitisai35.sh file from the website https://github.com/amd/Kria-https://github.com/amd/Kria-RoboticsAI/blob/main/files/scripts/install_update_kr260_to_vitisai35.sh into your Download Folder then move it to your home directory.
5. Execute the file
$ dos2unix install_update_kr260_to_vitisai35.sh
$ source ./install_update_kr260_to_vitisai35.sh
The pynq_venv virtual environment will be created.
6. Create the following folders then reboot:
$ mkdir -p KR260-Robotics-AI-Challenge/files/scripts
$ reboot
7. To set ROS in the virtual envirnment :
$ sudo su
root@kria:/home/ubuntu# source /etc/profile.d/pynq_venv.sh
(pynq-venv) root@kria:/home/ubuntu# cd KR260-Robotics-AI-Challenge/files/scripts# source ./install_ros.sh
(pynq-venv) root@kria:/home/ubuntu#cd KR260-Robotics-AI-Challenge/files/scripts# cd ros2_ws
(pynq-venv) root@kria:/home/ubuntu#cd KR260-Robotics-AI-Challenge/files/scripts/ros2_ws# source /opt/ros/humble/setup.bash
8.
Create two folders, ros_ws folder for ros workspace and src folder for ros packages:
(pynq-venv) root@kria:/home/ubuntu#cd KR260-Robotics-AI-Challenge/files/scripts/ros2_ws# mkdir -p ros_ws/src
9. Install the camera in ROS:
(pynq-venv) root@kria:/home/ubuntu#cd KR260-Robotics-AI-Challenge/files/scripts/ros2_ws# sudo apt install ros-humble-usb-cam
Mouth DetectionPlace the two files haarcascade_mouth.xml and haarcascade_mouth.xml in the src folder. The files can be found in the links:
https://www.fresnel.fr/perso/marot/Documents/Enseignements/RPi/haarcascade_mcs_mouth.xml
Two ROS packages, webcam_package and detectmouth_package were created to publish the video stream and to subscribe to the video respectively.
In a terminal, go to the src folder of your ros workpace, create and build the two packages:
#ros2 pkg create --build-type ament_python --dependencies rclpy sensor_msgs cv_bridge cv2 --node-name ImagePublisher webcam_package
#ros2 pkg create --build-type ament_python --dependencies rclpy sensor_msgs std_msgs geometry_msgs cv_bridge cv2 numpy --node-name mouthPublisher detectmouth_package
#colcon build
Place the two scripts ImagePublisher.py and mouthPublisher.py in the created webcam_package
and detectmouth_package
folders repectively.
Source the ros setup locally and run the ImagePublisher node:
#source install/local_setup.bash
#ros2 run webcam_package ImagePublisher
The terminal will show publishing video frame.
Open another terminal, go to the src folder of your ros workpace, source the ros setup locally and run the mouthPublisher node:
#source install/local_setup.bash
#ros2 run detectmouth_package mouthublisher
A window wll pop up and detect the mouth if there is face in front of the camera.
Install Moveit
# sudo apt install ros-humble-moveit
Setup ros environment and create and build the threejointrobot_package
package in src folder. Create
two folders inide the package then build the package:
#ros2 pkg create --build-type ament_python --dependencies rclpy std_msgs threejointrobot threejointrobot_package
#mkdir launch
#mkdir urdf
#colcon build
The threejoints.urdf file contains the model of a robot with six links and five joints. Put the file in the URDF folder.
Open moveit assistant to configure the robot.
#(pynq-venv) root@kria:/home/ubuntu/KR260-Robotics-AI-Challenge/files/scripts#
source /opt/ros/humble/setup.bash
#ros2 launch moveit_setup_assistant setup_assistant.launch.py verbose:=true
From Moveit, configure the robot using the path:
/home/ubuntu/KR260-Robotics-AI-Challenge/files/scripts/ros2_ws/src/threejointrobot_package/URDF/threejoints.urdf
The instructions to configure the robot can be found in this link: https://docs.ros.org/en/kinetic/api/moveit_tutorials/html/doc/setup_assistant/setup_assistant_tutorial.html
After the robot has been configured successfully, a srdf file for the robot, together ith other files, will be generated. Exit MoveIt Assisstant.
Add the package name (threejointrobot_package) to the package.xml file and the CMakeLists file then build the package again.
#colcon build
The robot could then be viewed in rviz2.
Future DevelpomentsThe SRDF file could be used to specify robot's poses in robotic applications. I would design a more ergonomic robot model and get a 3D camera so that I could get point cloud data to determine robot's poses and develop the robot into a feeding arm.
Thank you. It was a great experience and the KR260 hardware is really easy to set up.
Comments