Skip to content

travis: Add noetic #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ services:
- docker
env:
matrix:
- ROS_DISTRO="kinetic"
- ROS_DISTRO="melodic"
- ROS_DISTRO="noetic"
install:
- git clone --quiet --depth 1 https://github.com/ros-industrial/industrial_ci.git .industrial_ci
script:
Expand Down
25 changes: 16 additions & 9 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package>
<package format="3">
<name>video_stream_opencv</name>
<version>1.1.6</version>

Expand Down Expand Up @@ -28,17 +28,24 @@
<build_depend>rospy</build_depend>
<build_depend>sensor_msgs</build_depend>

<run_depend>cv_bridge</run_depend>
<run_depend>image_transport</run_depend>
<run_depend>camera_info_manager</run_depend>
<run_depend>dynamic_reconfigure</run_depend>
<run_depend>nodelet</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>
<run_depend>sensor_msgs</run_depend>
<exec_depend>cv_bridge</exec_depend>
<exec_depend>image_transport</exec_depend>
<exec_depend>camera_info_manager</exec_depend>
<exec_depend>dynamic_reconfigure</exec_depend>
<exec_depend>nodelet</exec_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>sensor_msgs</exec_depend>

<test_depend>rostest</test_depend>
<test_depend>rostopic</test_depend>
<test_depend>libgstrtspserver-1.0-dev</test_depend>
<test_depend>gstreamer1.0-plugins-ugly</test_depend>
<test_depend>gstreamer1.0-libav</test_depend>
<test_depend>gstreamer1.0-rtsp</test_depend>
<test_depend condition="$ROS_PYTHON_VERSION == 2">python-gi</test_depend>
<test_depend condition="$ROS_PYTHON_VERSION == 3">python3-gi</test_depend>
<test_depend condition="$ROS_PYTHON_VERSION == 2">python-gst-1.0</test_depend>

<export>
<nodelet plugin="${prefix}/nodelet_plugins.xml"/>
Expand Down
4 changes: 4 additions & 0 deletions test/delayed_launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash -e

sleep 5
exec $@
21 changes: 14 additions & 7 deletions test/mjpg_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
import rospy
import sys
import time
from BaseHTTPServer import BaseHTTPRequestHandler
from BaseHTTPServer import HTTPServer
from SocketServer import ThreadingMixIn
try:
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
except ImportError:
from BaseHTTPServer import BaseHTTPRequestHandler
from BaseHTTPServer import HTTPServer
try:
from socketserver import ThreadingMixIn
except ImportError:
from SocketServer import ThreadingMixIn


VIDEO_PATH = None
Expand Down Expand Up @@ -70,14 +77,14 @@ def mjpg_response(self):
ok, img = cv2.imencode('.jpg', img, [cv2.IMWRITE_JPEG_QUALITY, self.jpeg_quality])
if not ok:
continue
jpg = img.tostring()
self.wfile.write('--jpgboundary')
self.wfile.write(os.linesep)
jpg = img.tobytes()
self.wfile.write(b'--jpgboundary')
self.wfile.write(os.linesep.encode('utf-8'))
self.send_header('Content-type', 'image/jpeg')
self.send_header('Content-length', str(len(jpg)))
self.end_headers()
self.wfile.write(jpg)
self.wfile.write(os.linesep)
self.wfile.write(os.linesep.encode('utf-8'))
time.sleep(1.0 / self.loop_rate)
except KeyboardInterrupt:
break
Expand Down
64 changes: 64 additions & 0 deletions test/rtsp_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Yuki Furuta <furushchev@gmail.com>

import argparse
import os

import gi

gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import GLib, GObject, Gst, GstRtspServer

Gst.init(None)


class RTSPMediaFactory(GstRtspServer.RTSPMediaFactory):
def __init__(self, video_file, **properties):
super(RTSPMediaFactory, self).__init__(**properties)
self.video_file = video_file

def do_create_element(self, url):
# Build the pipeline: read from file, decode, convert video, encode to H264, and pack in RTP H264 payload
return Gst.parse_launch(' ! '.join([
'filesrc location={}'.format(self.video_file),
'decodebin',
'videoconvert',
'x264enc speed-preset=ultrafast tune=zerolatency',
'rtph264pay name=pay0 pt=96',
]))


def main():
p = argparse.ArgumentParser()
p.add_argument('--port', type=int, default=8554)
p.add_argument('video', type=str)

args, _ = p.parse_known_args()

if not os.path.exists(args.video):
p.error('Video {} does not exist'.format(args.video))

server = GstRtspServer.RTSPServer()
server.props.service = str(args.port)

factory = RTSPMediaFactory(args.video)
factory.set_shared(True)

mount_points = server.get_mount_points()
mount_points.add_factory('/video', factory)

server.attach(None)
print('RTSP server is running at rtsp://localhost:{}/video'.format(args.port))

loop = GLib.MainLoop()
try:
loop.run()
except KeyboardInterrupt:
print('Server interrupted, exiting...')
loop.quit()


if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion test/test_mjpg_stream.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<group ns="$(arg camera_name)">
<node pkg="video_stream_opencv" type="video_stream" name="$(arg camera_name)_stream"
launch-prefix="$(find video_stream_opencv)/test/delayed_launch.sh"
output="screen" respawn="true">
<remap from="camera" to="image_raw" />
<param name="camera_name" type="string" value="$(arg camera_name)" />
Expand All @@ -36,7 +37,7 @@
args="--port 8080 $(find video_stream_opencv)/test/small.mp4"
output="screen"/>

<test test-name="pubtest" pkg="rostest" type="publishtest">
<test test-name="test_mjpg_stream" pkg="rostest" type="publishtest" retry="2">
<rosparam>
topics:
- name: /mjpg/image_raw
Expand Down
34 changes: 22 additions & 12 deletions test/test_rtsp_stream.test
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
<?xml version="1.0"?>
<launch>
<include file="$(find video_stream_opencv)/launch/camera.launch" >
<arg name="camera_name" value="rtsp2"/>
<arg name="video_stream_provider" value="rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"/>
<arg name="buffer_queue_size" value="1000"/>
<arg name="fps" value="30"/>
<arg name="frame_id" value="rtsp_frame"/>
<arg name="camera_info_url" value=""/>
<arg name="flip_horizontal" value="false"/>
<arg name="flip_vertical" value="false"/>
<arg name="visualize" value="false"/>
</include>
<group ns="rtsp2">
<node pkg="video_stream_opencv" type="video_stream" name="rtsp2_stream"
launch-prefix="$(find video_stream_opencv)/test/delayed_launch.sh"
output="screen" respawn="true">
<remap from="camera" to="image_raw"/>
<rosparam>
camera_name: rtsp2
video_stream_provider: rtsp://localhost:8854/video
buffer_queue_size: 1000
fps: 30
frame_id: rtsp_frame
camera_info_url: ''
flip_horizontal: false
flip_vertical: false
</rosparam>
</node>
</group>

<test test-name="pubtest" pkg="rostest" type="publishtest">
<node name="rtsp_server" pkg="video_stream_opencv" type="rtsp_server.py"
args="--port 8854 $(find video_stream_opencv)/test/small.mp4"
output="screen"/>

<test test-name="test_rtsp_stream" pkg="rostest" type="publishtest">
<rosparam>
topics:
- name: /rtsp2/image_raw
Expand Down
2 changes: 1 addition & 1 deletion test/test_video_file.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<arg name="visualize" value="false"/>
</include>

<test test-name="pubtest" pkg="rostest" type="publishtest">
<test test-name="test_video_file" pkg="rostest" type="publishtest">
<rosparam>
topics:
- name: /videofile/image_raw
Expand Down