From 6f9c0d702dfa4dedc22588e868647e87e8d99826 Mon Sep 17 00:00:00 2001 From: dmalad Date: Wed, 29 Nov 2023 10:18:48 +0100 Subject: [PATCH] file tree reorganized --- .../CMakeLists.txt => CMakeLists.txt | 0 src/image2rtsp/LICENSE => LICENSE | 0 README.md | 1 - .../config => config}/parameters.yaml | 0 .../include => include}/image2rtsp.hpp | 0 .../include => include}/image_encodings.h | 0 .../launch => launch}/image2rtsp.launch.py | 0 src/image2rtsp/package.xml => package.xml | 0 {src/image2rtsp/python => python}/__init__.py | 0 {src/image2rtsp/python => python}/rtsp.py | 0 src/{image2rtsp/src => }/image2rtsp.cpp | 0 src/image2rtsp/README.md | 67 ------------------- src/{image2rtsp/src => }/video.cpp | 0 13 files changed, 68 deletions(-) rename src/image2rtsp/CMakeLists.txt => CMakeLists.txt (100%) rename src/image2rtsp/LICENSE => LICENSE (100%) rename {src/image2rtsp/config => config}/parameters.yaml (100%) rename {src/image2rtsp/include => include}/image2rtsp.hpp (100%) rename {src/image2rtsp/include => include}/image_encodings.h (100%) rename {src/image2rtsp/launch => launch}/image2rtsp.launch.py (100%) rename src/image2rtsp/package.xml => package.xml (100%) rename {src/image2rtsp/python => python}/__init__.py (100%) rename {src/image2rtsp/python => python}/rtsp.py (100%) rename src/{image2rtsp/src => }/image2rtsp.cpp (100%) delete mode 100644 src/image2rtsp/README.md rename src/{image2rtsp/src => }/video.cpp (100%) diff --git a/src/image2rtsp/CMakeLists.txt b/CMakeLists.txt similarity index 100% rename from src/image2rtsp/CMakeLists.txt rename to CMakeLists.txt diff --git a/src/image2rtsp/LICENSE b/LICENSE similarity index 100% rename from src/image2rtsp/LICENSE rename to LICENSE diff --git a/README.md b/README.md index 42a5e76..488ba66 100644 --- a/README.md +++ b/README.md @@ -65,4 +65,3 @@ python3 ~/image2rtsp/src/image2rtsp/python/rtsp.py - Port packages to ROS2 Humble. - Complete the functionality according to the functionality of the original ROS package. - diff --git a/src/image2rtsp/config/parameters.yaml b/config/parameters.yaml similarity index 100% rename from src/image2rtsp/config/parameters.yaml rename to config/parameters.yaml diff --git a/src/image2rtsp/include/image2rtsp.hpp b/include/image2rtsp.hpp similarity index 100% rename from src/image2rtsp/include/image2rtsp.hpp rename to include/image2rtsp.hpp diff --git a/src/image2rtsp/include/image_encodings.h b/include/image_encodings.h similarity index 100% rename from src/image2rtsp/include/image_encodings.h rename to include/image_encodings.h diff --git a/src/image2rtsp/launch/image2rtsp.launch.py b/launch/image2rtsp.launch.py similarity index 100% rename from src/image2rtsp/launch/image2rtsp.launch.py rename to launch/image2rtsp.launch.py diff --git a/src/image2rtsp/package.xml b/package.xml similarity index 100% rename from src/image2rtsp/package.xml rename to package.xml diff --git a/src/image2rtsp/python/__init__.py b/python/__init__.py similarity index 100% rename from src/image2rtsp/python/__init__.py rename to python/__init__.py diff --git a/src/image2rtsp/python/rtsp.py b/python/rtsp.py similarity index 100% rename from src/image2rtsp/python/rtsp.py rename to python/rtsp.py diff --git a/src/image2rtsp/src/image2rtsp.cpp b/src/image2rtsp.cpp similarity index 100% rename from src/image2rtsp/src/image2rtsp.cpp rename to src/image2rtsp.cpp diff --git a/src/image2rtsp/README.md b/src/image2rtsp/README.md deleted file mode 100644 index 488ba66..0000000 --- a/src/image2rtsp/README.md +++ /dev/null @@ -1,67 +0,0 @@ -## Acknowledgement -This project is a migration from ROS1 to ROS2. The original code was developed by [CircusMonkey](https://github.com/CircusMonkey/ros_rtsp/tree/master). I would like to express my gratitude for his contribution. - -## image2rtsp -The migration is still in process, thus the full functionality of the original package is not presented yet. The current version supports only the conversion of one chosen ROS2 topic into an RTSP stream with an expected delay of about 30-50ms. -It is being developed on Ubuntu 20.04 with ROS2 Foxy. - -## Dependencies -- ROS2 foxy - -- gstreamer libs: -```bash -sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev libgstrtspserver-1.0-dev gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad -``` -## Install - - Clone the package: - ```bashrc - git clone https://github.com/45kmh/ros2_rtsp.git - ``` - - Adjust `parameters.yaml` according to your needs: - ```bashrc - gedit ~/image2rtsp/src/image2rtsp/config/parameters.yaml - ``` -# Example ROS2 Image topic stream - topic: "/color/image_raw" # The ROS2 topic to subscribe to - mountpoint: "/back" # Choose the mountpoint for the rtsp stream. - # This will be able to be accessed from rtsp:///portAndMountpoint - caps: "video/x-raw,framerate=10/1,width=640,height=480" - # Set the caps to be applied after getting the ROS2 Image and before the x265 encoder. - bitrate: "500" - port: "8554" - local_only: True # True = rtsp://127.0.0.1:port (The stream is accessible only from the local machine) - # False = rtsp://0.0.0.0:portAndMountpoint (The stream is accessible from the outside) - # For example, to access the stream running on the machine with IP = 192.168.20.20, - # use rtsp://192.186.20.20:portAndMountpoint - # True = rtsp://127.0.0.1:portAndMountpoint (The stream is accessible only from the local machine) - - Save your configuration and navigate to `image2rtsp ` colcon root, source and build the package: - ```bashrc - cd ~/image2rtsp/ - colcon build --packages-select image2rtsp - ``` -## Run - - Source `install` and launch the package: - ```bashrc - source install/setup.bash - ros2 launch image2rtsp image2rtsp.launch.py - ``` - Don't use **`ros2 run`**! - -## Check the stream -To check the stream, follow the instructions for gstreamer, mpv or VLC provided by [CircusMonkey](https://github.com/CircusMonkey/ros_rtsp/blob/master/README.md) or use python script (ensure before that the open-cv library is installed, if not `pip install opencv-python`): -```bash -gedit ~/image2rtsp/src/image2rtsp/python/rtsp.py -``` -Replace the `rtsp://127.0.0.1:8554/back` with your server's IP address, port and mount point `rtsp://YOUR_IP:PORT/MOUNT_POINT`. Save and run: -```bash -python3 ~/image2rtsp/src/image2rtsp/python/rtsp.py -``` -## Limitations -- As was previously mentioned, this package allows the conversion of only one topic into an RTSP Stream. -- Some machines may have a significantly bigger delay of about 150-200ms. The reason is currently unknown. -## To Do -- Add a branch with the package rewritten as a ROS2 component -- Port the package to Nvidia Jetson Orin. Will the use of the Nvidia encoder make the delay smaller? -- Port packages to ROS2 Humble. -- Complete the functionality according to the functionality of the original ROS package. - diff --git a/src/image2rtsp/src/video.cpp b/src/video.cpp similarity index 100% rename from src/image2rtsp/src/video.cpp rename to src/video.cpp