This repository contains instructions for:
- Running the GPS UART parsing script
- Launching video streaming through MediaMTX
- Building and running the ROS2 package
gps_uart_reader
Clone the repository and switch to the required branch:
git clone https://github.com/SergiiGrynevych/Embedded_test_ros.git
cd ~/Embedded_test_ros/Replace
<REPO_URL>and<REPO_FOLDER>with your actual repository values.
Make sure the system has the following installed:
python3pip3MediaMTXROS2(Humble,Foxy, or another compatible version)colcon
Optional, depending on how you validate video streaming:
ffmpegffplayVLC- GStreamer packages
cd ~/Embedded_test_ros/
python3 UART_ParsingGPS.pyIf pyserial is missing, install it with:
pip3 install pyserialGo to the MediaMTX folder:
cd ~/Embedded_test_ros/VideoStreaming/
chmod +x ~/Embedded_test_ros/VideoStreaming/mediamtx
chmod +x ~/Embedded_test_ros/VideoStreaming/rgb_cam_ffmpeg.sh
chmod +x ~/Embedded_test_ros/VideoStreaming/rgb_cam_gstreamer.sh./mediamtx mediamtx_ffmpeg.yml./mediamtx mediamtx_gstreamer.ymlto run correctly video streamer in rgb_cam_ffmpeg.sh and rgb_cam_gstreamer.sh you need to set correctly variable DEVICE. In my case i use camera and search it by v4l2-ctl --list-devices
From another computer on the same network, you can verify the stream in the following ways.
http://<IP_ADDR_BOARD>:8080/stream/
ffplay rtsp://<IP_ADDR_BOARD>:8554/streamrtsp://<IP_ADDR_BOARD>:8554/stream
If GStreamer dependencies are missing, install them with:
sudo apt install -y \
gstreamer1.0-tools \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-rtsp \
libgstrtspserver-1.0-0 \
libgstrtspserver-1.0-devA ROS2 distribution must be installed in your system, such as:
- ROS2 Humble
- ROS2 Foxy
- or another compatible version
This will build the ROS2 interface package gps_position_msgs and the package gps_uart_reader.
cd ~/Embedded_test_ros/ros2
colcon build --packages-up-to gps_uart_readerAfter building, source the workspace:
source ~/Embedded_test_ros/ros2/install/setup.bashsource ~/Embedded_test_ros/ros2/install/setup.bash
cd ~/Embedded_test_ros/ros2
ros2 launch gps_uart_reader gps_uart.launch.pysource ~/ros2/install/setup.bash
ros2 run gps_uart_reader gps_node --ros-args -p port:=/dev/ttyS5 -p baudrate:=9600Install required Python and ROS2 build dependencies:
pip3 install pyserial
sudo apt install python3-colcon-common-extensionsros2 interface show gps_position_msgs/msg/GpsPosition- Replace
<IP_ADDR_BOARD>with the actual IP address of the board. - Make sure the board and the client computer are in the same network.
- If
ffplayis not installed on the client machine, use VLC or browser playback instead. - If ROS2 commands are not found, first source the appropriate ROS2 environment.
cd ~
python3 UART_ParsingGPS.pyFFmpeg:
cd ~/VideoStreaming/
./mediamtx mediamtx_ffmpeg.ymlGStreamer:
cd ~/VideoStreaming/
./mediamtx mediamtx_gstreamer.ymlcd ~/ros2
colcon build --packages-up-to gps_uart_reader
source ~/ros2/install/setup.bash
ros2 launch gps_uart_reader gps_uart.launch.pyhttp://<IP_ADDR_BOARD>:8080/stream/
ffplay rtsp://<IP_ADDR_BOARD>:8554/streamros2 interface show gps_position_msgs/msg/GpsPosition