Skip to content

Commit

Permalink
ROS2 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasweihing committed Sep 23, 2024
1 parent 194901e commit fa9d6c4
Show file tree
Hide file tree
Showing 30 changed files with 2,783 additions and 298 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

models/
58 changes: 39 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,61 @@
# ROS2 Example Package
# Lane Detection AI

[![Build Test](https://github.com/DHBW-Smart-Rollerz/ros2_exaple_package/actions/workflows/build-test.yaml/badge.svg)](https://github.com/DHBW-Smart-Rollerz/ros2_exaple_package/actions/workflows/build-test.yaml)

This repository contains an example package for ros2 (python).
This repository contains the ros2 jazzy package for the ai lane detection based on the [ultra fast lane detection v2](https://github.com/cfzd/Ultra-Fast-Lane-Detection-v2).


# Lane Detection AI

## Installation

1. Clone the package into the `smarty_workspace/src` directory:
```bash
git clone <repository-url> smarty_workspace/src
```
2. Install the required Python dependencies using the `requirements.txt` file:
```bash
pip install -r requirements.txt
```
3. Download the trained model and its corresponding configuration file. (See the [Usage](#usage) section for more details.)

## Usage

This repository can be used as template. Simply select this repo when creating a new repository under template.
To run this package, you will need the pre-trained model weights. As of September 2024, two versions are available: a dense model and a sparse model. You can download them [here](https://it-nas.dhbw-stuttgart.de:5001/?launchApp=SYNO.SDS.Drive.Application#file_id=842460996588058121). Place the downloaded model in the `models/` folder, and the corresponding configuration file in the `config/` folder.

Alternatively, you can create python ros packages with:
**Important:**
Ensure that you update the `model_config_path` in the `config/ros_params.yaml` file, and set the correct path for the model in the configuration file's `test_model` field.

```bash
# If not already created
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
### Running the Node

# Create package
ros2 pkg create my_package --build-type ament_python --dependencies rclpy
To launch the node, use the following command:
```bash
ros2 launch lane_detection_ai lane_detection_ai.launch.py
```

# Build
cd ~/ros2_ws/src
colcon build --symlink-install --packages-select my_package
For running with the debug image enabled, use:
```bash
ros2 launch lane_detection_ai lane_detection_ai.launch.py debug:=true
```


## Structure

- `config/`: All configurations (most of the time yaml files)
- `launch/`: Contains all launch files. Launch files can start multiple nodes with yaml-configurations
- `models/`: Contains all models (optional) and only necessary for machine learning nodes
- `config/`: All configurations for ROS and the model
- `launch/`: Contains the launch files
- `models/`: Contains the models
- `resource/`: Contains the package name (required to build with colcon)
- `ros2_example_package`: Contains all nodes and sources for the ros package
- `test/`: Contains all tests
- `lane_detection_ai/`: Contains all nodes and sources for the ros package
- `lane_detection_ai/model/`: Contains all sources of the ufldv2 model
- `test/`: Contains the tests
- `package.xml`: Contains metadata about the package
- `setup.py`: Used for Python package configuration
- `setup.cfg`: Additional configuration for the package
- `requirements.txt`: Python dependencies

<!--
The contributing section is currently not required as we do not plan to have public contribution.
## Contributing
Thank you for considering contributing to this repository! Here are a few guidelines to get you started:
Expand All @@ -46,7 +66,7 @@ Thank you for considering contributing to this repository! Here are a few guidel
4. Commit your changes and push them to your forked repository.
5. Submit a pull request with a clear description of your changes.
We appreciate your contributions and look forward to reviewing them!
We appreciate your contributions and look forward to reviewing them! -->

## License

Expand Down
4 changes: 0 additions & 4 deletions config/model.yaml

This file was deleted.

18 changes: 6 additions & 12 deletions config/ros_params.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
# This file contains example node parameters.
ros2_example_node:
lane_detection_ai_node:
ros__parameters:
# Path of the debug image
image_path: 'resources/img/example.png'

# Path of the model
model_config_path: 'config/model.yaml'
# Path of the model config
model_config_path: "config/model_sparse_config.py"

# Topics for an example publisher and subscriber
image_topic: '/camera/undistorted'
result_topic: '/example/result'
debug_image_topic: '/example/debug_image'

# Some example value with a unit
example_value: 500 # in px
image_topic: "/camera/undistorted"
result_topic: "/lane_detection/result"
debug_image_topic: "/lane_detection/debug_image"
File renamed without changes.
Loading

0 comments on commit fa9d6c4

Please sign in to comment.