HBRS-SDP / ss22-ros2-perception

GNU General Public License v3.0
0 stars 3 forks source link

MIR Object Recognition ROS2 Code Base

Features impelemented

Note: The code is only tested with the RGB recognition. The depth recognition is not tested due to the lack of 3D object recognition models.

Environmental setup

Note: Ubuntu 20.04 LTS(Focal Fossa) is recommended for this codebase to work.

Install ROS2 Rolling

sudo apt install ros-rolling-desktop

For more details, see ROS2 Rolling Installation.

Source the setup script

source /opt/ros/rolling/setup.bash

Install dependencies

Clone the necessary packages into the workspace

mkdir ~/mir_object_recognition/src
cd ~/mir_object_recognition/src

git clone --branch rolling-devel https://github.com/HBRS-SDP/ss22-ros2-perception.git .

git clone --branch foxy-devel https://github.com/HBRS-SDP/mas_perception_msgs.git

Note: If you want to use the bag file for RGB image and Pointcloud data, skip the next step.

Setup the RealSense SDK and ROS2 wrapper for RealSense cameras

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE

sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u

sudo apt-get install librealsense2-dkms librealsense2-utils librealsense2-dev

git clone https://github.com/IntelRealSense/realsense-ros.git -b ros2-beta

Build the workspace

colcon build 
source install/setup.bash

Steps to run the mmor component:

Note: Make sure to source the ROS rolling and devel in all the terminals

Step 0:

Step 1:

Or

Note:

Step 2:

Step 3:

Step 4:

Step 5:

ros2 run lifecycle_controller lifecycle_controller --ros-args -p lc_name:=mmor

Step 6:

Step 7:

Step 8:

To perform RGB object recognition, follow the steps below:

Steps to run the data collector component:

Step 1:

Follow the first step for the MMOR component and run either the bagfile or the realsense node.

Step 2: In a new terminal with the workspace sourced, run the launch file for the data collector component

ros2 launch mir_object_recognition data_collector.launch.py

Step 3: In another terminal, run the lifecycle controller node and pass 'data_collector' as the lc_name argument.

ros2 run lifecycle_controller lifecycle_controller --ros-args -p lc_name:=data_collector

Step 4:

Press C to transition the data_collector component from UNCONFIGURED to INACTIVE state, and then press A to transition it to ACTIVE state. In this state, the component will start saving the pointcloud clusters and the RGB image. By default, the location is the '/tmp/' directory, but if you want to change this, you can provide the desired location as an argument to the launchfile like the following example:

ros2 launch mir_object_recognition data_collector.launch.py log_directory:=/home/user/Pictures/

More details about the concepts, issues and resources can be found on the wiki page.