diff --git a/.travis.yml b/.travis.yml index df48384..58d6f54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ - -# this is .traivs.yml written by ./create_travis_settings.py +# this is .traivs.yml written by - # https://github.com/ros-infrastructure/ros_buildfarm/blob/master/doc/jobs/devel_jobs.rst # https://github.com/ros-infrastructure/ros_buildfarm/blob/master/doc/jobs/prerelease_jobs.rst @@ -8,16 +7,13 @@ sudo: true dist: trusty language: python python: - - "3.4" + - "3.6" env: global: - JOB_PATH=/tmp/devel_job - ABORT_ON_TEST_FAILURE=1 matrix: - - ROS_DISTRO_NAME=indigo OS_NAME=ubuntu OS_CODE_NAME=trusty ARCH=amd64 - - ROS_DISTRO_NAME=kinetic OS_NAME=ubuntu OS_CODE_NAME=xenial ARCH=amd64 - - ROS_DISTRO_NAME=lunar OS_NAME=ubuntu OS_CODE_NAME=xenial ARCH=amd64 - - ROS_DISTRO_NAME=melodic OS_NAME=ubuntu OS_CODE_NAME=bionic ARCH=amd64 + - ROS_DISTRO_NAME=noetic OS_NAME=ubuntu OS_CODE_NAME=focal ARCH=amd64 # matrix: # allow_failures: # - env: ROS_DISTRO_NAME=kinetic OS_NAME=ubuntu OS_CODE_NAME=xenial ARCH=amd64 diff --git a/CMakeLists.txt b/CMakeLists.txt index 98166b7..c62c070 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,16 @@ -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.0.2) project(gscam) # System Dependencies -find_package(PkgConfig) +# pkg-config libraries +find_package(PkgConfig REQUIRED) + +# +# For Noetic +# - removed ROSBUILD target (deprecated) +# - should remove gstreamer-0.10 support (old) +# pkg_check_modules(GSTREAMER QUIET gstreamer-0.10) if(NOT GSTREAMER_FOUND) @@ -19,112 +26,67 @@ else() pkg_check_modules(GST_APP REQUIRED gstreamer-app-0.10) endif() -if(USE_ROSBUILD) - # Use rosbuild - include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) - - rosbuild_init() - - set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) - set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) - - include_directories(${GLIB_INCLUDE_DIRS} ${GST_APP_INCLUDE_DIRS}) - - rosbuild_add_library(gscam src/gscam.cpp) - target_link_libraries(gscam - ${GSTREAMER_LIBRARIES} - ${GST_APP_LIBRARIES}) - rosbuild_add_executable(gscam_node src/gscam_node.cpp) - target_link_libraries(gscam_node gscam - ${GSTREAMER_LIBRARIES} - ${GST_APP_LIBRARIES}) - set_target_properties(gscam_node PROPERTIES OUTPUT_NAME gscam) - - rosbuild_add_library(GSCamNodelet src/gscam_nodelet.cpp) - target_link_libraries(GSCamNodelet gscam - ${GSTREAMER_LIBRARIES} - ${GST_APP_LIBRARIES}) - -else() - # Use Catkin - find_package(catkin REQUIRED - COMPONENTS roscpp image_transport sensor_msgs nodelet - camera_calibration_parsers camera_info_manager - ) - - catkin_package( - INCLUDE_DIRS include - LIBRARIES gscam - CATKIN_DEPENDS roscpp nodelet image_transport sensor_msgs - camera_calibration_parsers camera_info_manager - DEPENDS GSTREAMER GST_APP - ) - - include_directories( - include - ${catkin_INCLUDE_DIRS} - ${GLIB_INCLUDE_DIRS} - ${GST_APP_INCLUDE_DIRS}) - - add_library(gscam src/gscam.cpp) - target_link_libraries(gscam - ${catkin_LIBRARIES} - ${GSTREAMER_LIBRARIES} - ${GST_APP_LIBRARIES}) - - add_executable(gscam_node src/gscam_node.cpp) - target_link_libraries(gscam_node gscam - ${catkin_LIBRARIES} - ${GSTREAMER_LIBRARIES} - ${GST_APP_LIBRARIES}) - set_target_properties(gscam_node PROPERTIES OUTPUT_NAME gscam) - - add_library(GSCamNodelet src/gscam_nodelet.cpp) - target_link_libraries(GSCamNodelet gscam - ${catkin_LIBRARIES} - ${GSTREAMER_LIBRARIES} - ${GST_APP_LIBRARIES}) - - # Install directives - - install(TARGETS gscam gscam_node GSCamNodelet - ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} - LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} - RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} - ) - - install(DIRECTORY include/${PROJECT_NAME}/ - DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} - PATTERN ".svn" EXCLUDE) - - install(FILES nodelet_plugins.xml - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} - ) - - install(FILES - examples/v4l.launch - examples/gscam_nodelet.launch - examples/nodelet_pipeline.launch - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} - ) - - install(FILES examples/uncalibrated_parameters.ini - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/examples - ) - - # Interim compatibility - # Remove this in the next release - install(FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gscam_node - DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) - set(EXECUTABLE_OUTPUT_PATH ${CATKIN_DEVEL_PREFIX}/lib/${PROJECT_NAME}) -endif() +# Use Catkin build tools. +find_package(catkin REQUIRED COMPONENTS roscpp image_transport sensor_msgs camera_calibration_parsers camera_info_manager ) + +catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME} + CATKIN_DEPENDS roscpp image_transport sensor_msgs camera_calibration_parsers camera_info_manager + DEPENDS GSTREAMER GST_APP +) + +# Build defs +include_directories( + include + ${catkin_INCLUDE_DIRS} + ${GLIB_INCLUDE_DIRS} + ${GST_APP_INCLUDE_DIRS} +) + +add_library(${PROJECT_NAME} src/gscam.cpp) +target_link_libraries(${PROJECT_NAME} + ${catkin_LIBRARIES} + ${GSTREAMER_LIBRARIES} + ${GST_APP_LIBRARIES} +) + +add_executable(${PROJECT_NAME}_node src/gscam_node.cpp) +target_link_libraries(${PROJECT_NAME}_node + ${PROJECT_NAME} + ${catkin_LIBRARIES} + ${GSTREAMER_LIBRARIES} + ${GST_APP_LIBRARIES} +) +set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) + +# Install directives + +install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +) + +install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" +) + +install(FILES nodelet_plugins.xml + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} +) + +install(DIRECTORY launch/ + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch + FILES_MATCHING PATTERN "*.launch" +) + +install(FILES examples/uncalibrated_parameters.ini + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/examples +) + +set(EXECUTABLE_OUTPUT_PATH ${CATKIN_DEVEL_PREFIX}/lib/${PROJECT_NAME}) -# Interim compatibility -# Remove this in the next distribution release -configure_file(scripts/gscam_node.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gscam_node) -file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gscam_node - DESTINATION ${EXECUTABLE_OUTPUT_PATH} - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) diff --git a/Makefile b/Makefile deleted file mode 100644 index 73e8a91..0000000 --- a/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -EXTRA_CMAKE_FLAGS = -DUSE_ROSBUILD:BOOL=1 -include $(shell rospack find mk)/cmake.mk diff --git a/README.md b/README.md index 6c6a1e7..b2aa43e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ several fixes incorporated into it to make it broadcast correct `sensor_msgs/Image` messages with proper frames and timestamps. It also allows for more ROS-like configuration and more control over the GStreamer interface. -Note that this pacakge can be built both in a rosbuild and catkin workspaces. +Note that this pacakge now only supports building in catkin workspaces. GStreamer Library Support ------------------------- @@ -38,7 +38,7 @@ sudo add-apt-repository ppa:gstreamer-developers/ppa sudo apt-get install gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev ``` -##### 14.04 +##### 14.04 + 16.04 + 18.04 + 20.04 ```sh sudo apt-get install gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev @@ -46,7 +46,7 @@ sudo apt-get install gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins #### Usage: * Use the CMake flag `-DGSTREAMER_VERSION_1_x=On` when building -* See the [Video4Linux2 launchfile example](examples/v4l.launch) for +* See the [Video4Linux2 launchfile example](launch/v4l.launch) for an example of the differences in the GStreamer config lines #### Notes: @@ -70,7 +70,7 @@ This can be run as both a node and a nodelet. * `camera/set_camera_info` #### Parameters -* `~camera_name`: The name of the camera (corrsponding to the camera info) +* `~camera_name`: The name of the camera (corresponding to the camera info - `camera_name/` replaces `camera/` in the topic list) * `~camera_info_url`: A url (`file://path/to/file`, `package://pkg_name/path/to/file`) to the [camera calibration file](http://www.ros.org/wiki/camera_calibration_parsers#File_formats). * `~gscam_config`: The GStreamer [configuration string](http://wiki.oz9aec.net/index.php?title=Gstreamer_cheat_sheet&oldid=1829). * `~frame_id`: The [TF](http://www.ros.org/wiki/tf) frame ID. @@ -88,12 +88,15 @@ Examples See example launchfiles and configs in the examples directory. Currently there are examples for: -* [Video4Linux2](examples/v4l.launch): Standard +* [Video4Linux2](launch/v4l.launch): Standard [video4linux](http://en.wikipedia.org/wiki/Video4Linux)-based cameras like USB webcams. * ***GST-1.0:*** Use the roslaunch argument `GST10:=True` for GStreamer 1.0 variant -* [Nodelet](examples/gscam_nodelet.launch): Run a V4L-based camera in a nodelet -* [Video File](examples/videofile.launch): Any videofile readable by GStreamer -* [DeckLink](examples/decklink.launch): +* [Nodelet](launch/gscam_nodelet.launch): Run a V4L-based camera in a nodelet +* [Video File](launch/videofile.launch): Any videofile readable by GStreamer +* [DeckLink](launch/decklink.launch): [BlackMagic](http://www.blackmagicdesign.com/products/decklink/models) DeckLink SDI capture cards (note: this requires the `gst-plugins-bad` plugins) +* [tdgigevsrc](launch/tdgigev.launch launch/tdgigev_bayer.launch) for GigeVision cameras. + This requires the Teledyne DALSA GigE-V Source plugin for gstreamer-1.0 + diff --git a/examples/decklink.launch b/launch/decklink.launch similarity index 100% rename from examples/decklink.launch rename to launch/decklink.launch diff --git a/examples/gscam_nodelet.launch b/launch/gscam_nodelet.launch similarity index 100% rename from examples/gscam_nodelet.launch rename to launch/gscam_nodelet.launch diff --git a/examples/minoru.launch b/launch/minoru.launch similarity index 100% rename from examples/minoru.launch rename to launch/minoru.launch diff --git a/examples/nodelet_pipeline.launch b/launch/nodelet_pipeline.launch similarity index 100% rename from examples/nodelet_pipeline.launch rename to launch/nodelet_pipeline.launch diff --git a/examples/osx.launch b/launch/osx.launch similarity index 100% rename from examples/osx.launch rename to launch/osx.launch diff --git a/launch/tdgigev.launch b/launch/tdgigev.launch new file mode 100644 index 0000000..ac458dc --- /dev/null +++ b/launch/tdgigev.launch @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/launch/tdgigev_bayer.launch b/launch/tdgigev_bayer.launch new file mode 100644 index 0000000..940f8b2 --- /dev/null +++ b/launch/tdgigev_bayer.launch @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/v4l.launch b/launch/v4l.launch similarity index 100% rename from examples/v4l.launch rename to launch/v4l.launch diff --git a/examples/v4ljpeg.launch b/launch/v4ljpeg.launch similarity index 100% rename from examples/v4ljpeg.launch rename to launch/v4ljpeg.launch diff --git a/examples/videofile.launch b/launch/videofile.launch similarity index 100% rename from examples/videofile.launch rename to launch/videofile.launch diff --git a/src/gscam.cpp b/src/gscam.cpp index d0c6cc9..592d8f1 100644 --- a/src/gscam.cpp +++ b/src/gscam.cpp @@ -223,7 +223,14 @@ namespace gscam { jpeg_pub_ = nh_.advertise("camera/image_raw/compressed",1); cinfo_pub_ = nh_.advertise("camera/camera_info",1); } else { - camera_pub_ = image_transport_.advertiseCamera("camera/image_raw", 1); + if ( camera_name_.compare("default") ) { + std::string camname_; + camname_ = camera_name_ + "/image_raw"; + camera_pub_ = image_transport_.advertiseCamera(camname_.c_str(), 1); + } + else { + camera_pub_ = image_transport_.advertiseCamera("camera/image_raw", 1); + } } return true; @@ -291,16 +298,6 @@ namespace gscam { // GST_TIME_AS_USECONDS(buf->timestamp+bt)/1e6+time_offset_, buf->timestamp, bt, time_offset_); -#if 0 - GstFormat fmt = GST_FORMAT_TIME; - gint64 current = -1; - - Query the current position of the stream - if (gst_element_query_position(pipeline_, &fmt, ¤t)) { - ROS_INFO_STREAM("Position "<