Compare commits

..

No commits in common. "7e8d3fb2a8e82b9e114401d315d9b5e10894ca08" and "9189153436011f26a682546bb72881af746f4839" have entirely different histories.

View File

@ -4,52 +4,17 @@ This repository contains code for detecting heat pipes in the greenhouse as well
Platform: ROS 2, Humble, Ubuntu 22.04 Platform: ROS 2, Humble, Ubuntu 22.04
## How to install dependencies?? ## How to build the workspace?
- Install `git`
```
$ sudo apt install git
```
-
- Install `ROS 2 Humble` on `Ubuntu 22.04` by following https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html
- Install `colcon build` by following https://docs.ros.org/en/foxy/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html
```
$ sudo apt install python3-colcon-common-extensions
```
- Instal `pip` for python packages
```
$ sudo apt install python3-pip
```
- Now clone the repository
``` ```
$ git clone https://tea.der-space.de/apoorva/greenhouse.git $ git clone https://tea.der-space.de/apoorva/greenhouse.git
``` ```
- Install `ultralytics` for yolov3 package ## How to install dependencies??
``` ```
$ pip install ultralytics
sudo apt-get install ros-humble-$(PACKAGE_NAME)
``` ```
- For `yolov3_ros`, there are a bunch of other requirements. Go to `yolov3` folder and install using following commands:
```
$ cd ~/greenhouse/yolov3
$ pip install -r requirements.txt
```
- Go to `ros2_ws` inside `greenhouse`. Make sure you only have `src` folder.
```
$ cd ~/greenhouse/ros2_ws
$ ls
src
```
- Inside `ros2_ws` folder, start building individual packages in the below sequence to avoid errors.
```
$ colcon build --packages-select pipe_msgs
$ colcon build packages-select pcl_ros
$ colcon build allow-overriding pcl_ros
$ colcon build packages-select pcl_conversions
$ colcon build allow-overriding pcl_conversions
$ colcon build --packages-select find-pose
$ colcon build packages-select yolov3_ros
. install/setup.bash
```
- The code should be ready to launch as explained in [How to run Live Detection?](#how-to-run-live-detection)
This section explains what each module is responsible for. This section explains what each module is responsible for.
## perception_pcl ## perception_pcl
This module is responsible for providing `pcl_conversions` and `pcl_ros` modules in `ros 2`. This module is responsible for providing `pcl_conversions` and `pcl_ros` modules in `ros 2`.
@ -108,7 +73,7 @@ The following input/ros topics are needed:
ROS Paramater Input: ROS Paramater Input:
- best_weights: String that is the path to the best weights file of yolov3 detection - best_weights: String that is the path to the best weights file of yolov3 detection
Defaults: `'src/pipe_weights.pt'` inside `ros2_ws` folder Defaults: `'src/pipe_weights.pt'`
The following are the output topics: The following are the output topics:
- /detection_image: The RGB Image topic with bounding box drawn on it for visualization and debugging purpose - /detection_image: The RGB Image topic with bounding box drawn on it for visualization and debugging purpose
@ -121,7 +86,6 @@ How to build and run?
``` ```
$ colcon build --packages-select yolov3_ros $ colcon build --packages-select yolov3_ros
$ . install/setup.bash $ . install/setup.bash
$ cd greenhouse/ros2_ws/
$ ros2 launch yolov3_ros pipe_detection.launch.py $ ros2 launch yolov3_ros pipe_detection.launch.py
``` ```
All the topics can be remapped in the launch file. The path to best_weights can also be changed inside the launch file. All the topics can be remapped in the launch file. The path to best_weights can also be changed inside the launch file.
@ -224,22 +188,21 @@ $ ros2 bag play bag-folder/bag-name.db3
- Once you have updated the launch file, build the code again using `colcon build --packages-select yolov3_ros` and proceedas mentioned below. - Once you have updated the launch file, build the code again using `colcon build --packages-select yolov3_ros` and proceedas mentioned below.
Steps to run: Steps to run:
- Open a terminal. 1. Open a terminal.
- Run `$ cd greenhouse/ros2_ws/` and `$ . install/setup.bash`. 2. Run `$ cd greenhouse/ros2_ws/` and `$ . install/setup.bash`.
- Launch node for object detection: 3. Launch node for object detection:
``` ```
$ ros2 launch yolov3_ros pipe_detection.launch.py $ ros2 launch yolov3_ros pipe_detection.launch.py
``` ```
This node will output two topics: `/bboxes` and `/detection_image`. This node will output two topics: `/bboxes` and `/detection_image`.
Make sure that you run this launch file from `greenhouse/ros2_ws/` folder since the path of weights is relative (`/src/pipe_weights.pt`) inside the launch file. 4. Launch node for pose estimation:
- Launch node for pose estimation:
``` ```
$ ros2 launch find-pose find-pose-node.launch.py $ ros2 launch find-pose find-pose-node.launch.py
``` ```
This node will output TF topics between `/camera_link` and `/${detected_object_name}`. This node will output TF topics between `/camera_link` and `/${detected_object_name}`.
- Open RVIZ by running `$ rviz2`. Change `fixed frame` from `map` to `camera_link`. 5. Open RVIZ by running `$ rviz2`. Change `fixed frame` from `map` to `camera_link`.
-- Go to `Add` button. Under `By Display type`, select `tf`. Once tf is added, select required frames like `camera_link` and `l_trail` to see the tfs. 5a. Go to `Add` button. Under `By Display type`, select `tf`. Once tf is added, select required frames like `camera_link` and `l_trail` to see the tfs.
-- To see the current image with detected object, Go to `Add` Button. Under `By Topic`, select topci called `detection_image`. 5b. To see the current image with detected object, Go to `Add` Button. Under `By Topic`, select topci called `detection_image`.
You can add other topics as per the need and topic names. You can add other topics as per the need and topic names.
- You can open launch files to update/remap topic name if different camera is being used. 6. You can open launch files to update/remap topic name if different camera is being used.
- You can also update ros parameter from launch file. Currently, the `pipe_weights.pt` file is the one used. This file can be changed and you can update the parameter name `best_weights` inside the `pipe_detection.launch.py` file. 7. You can also update ros parameter from launch file. Currently, the `pipe_weights.pt` file is the one used. This file can be changed and you can update the parameter name `best_weights` inside the `pipe_detection.launch.py` file.