Compare commits

...

2 Commits

Author SHA1 Message Date
7e8d3fb2a8 updated with dependencies 2023-04-05 15:31:08 +05:30
3c49096d39 one more update to readme 2023-04-05 15:31:08 +05:30

View File

@ -4,17 +4,52 @@ This repository contains code for detecting heat pipes in the greenhouse as well
Platform: ROS 2, Humble, Ubuntu 22.04
## How to build the workspace?
## How to install dependencies??
- 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
```
## How to install dependencies??
- Install `ultralytics` for yolov3 package
```
sudo apt-get install ros-humble-$(PACKAGE_NAME)
$ pip install ultralytics
```
- 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.
## perception_pcl
This module is responsible for providing `pcl_conversions` and `pcl_ros` modules in `ros 2`.
@ -73,7 +108,7 @@ The following input/ros topics are needed:
ROS Paramater Input:
- best_weights: String that is the path to the best weights file of yolov3 detection
Defaults: `'src/pipe_weights.pt'`
Defaults: `'src/pipe_weights.pt'` inside `ros2_ws` folder
The following are the output topics:
- /detection_image: The RGB Image topic with bounding box drawn on it for visualization and debugging purpose
@ -86,6 +121,7 @@ How to build and run?
```
$ colcon build --packages-select yolov3_ros
$ . install/setup.bash
$ cd greenhouse/ros2_ws/
$ 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.
@ -188,21 +224,22 @@ $ 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.
Steps to run:
1. Open a terminal.
2. Run `$ cd greenhouse/ros2_ws/` and `$ . install/setup.bash`.
3. Launch node for object detection:
- Open a terminal.
- Run `$ cd greenhouse/ros2_ws/` and `$ . install/setup.bash`.
- Launch node for object detection:
```
$ ros2 launch yolov3_ros pipe_detection.launch.py
```
This node will output two topics: `/bboxes` and `/detection_image`.
4. Launch node for pose estimation:
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.
- Launch node for pose estimation:
```
$ ros2 launch find-pose find-pose-node.launch.py
```
This node will output TF topics between `/camera_link` and `/${detected_object_name}`.
5. Open RVIZ by running `$ rviz2`. Change `fixed frame` from `map` to `camera_link`.
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.
5b. To see the current image with detected object, Go to `Add` Button. Under `By Topic`, select topci called `detection_image`.
- 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.
-- 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.
6. You can open launch files to update/remap topic name if different camera is being used.
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.
- 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.