Skip to content

Commit

Permalink
add image_transport_plugins, support compressed and theora transport
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonk3664 authored and fengqikai1414 committed Mar 15, 2018
1 parent e036817 commit 86d9dc6
Show file tree
Hide file tree
Showing 42 changed files with 3,321 additions and 0 deletions.
64 changes: 64 additions & 0 deletions ros/image_transport_plugin/.travis.yml
@@ -0,0 +1,64 @@
sudo: required
dist: trusty
language: generic
env:
- OPENCV_VERSION=2 ROS_DISTRO=indigo
- OPENCV_VERSION=3 ROS_DISTRO=indigo
- OPENCV_VERSION=2 ROS_DISTRO=jade
- OPENCV_VERSION=3 ROS_DISTRO=jade
# Install system dependencies, namely ROS.
before_install:
# Define some config vars.
- export ROS_CI_DESKTOP=`lsb_release -cs` # e.g. [precise|trusty]
- export CI_SOURCE_PATH=$(pwd)
- export REPOSITORY_NAME=${PWD##*/}
- export ROSINSTALL_FILE=$CI_SOURCE_PATH/dependencies.rosinstall
- export CATKIN_OPTIONS=$CI_SOURCE_PATH/catkin.options
- export ROS_PARALLEL_JOBS='-j8 -l6'
# Install ROS
- sudo sh -c "echo \"deb http://packages.ros.org/ros-shadow-fixed/ubuntu $ROS_CI_DESKTOP main\" > /etc/apt/sources.list.d/ros-latest.list"
- wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
- sudo apt-get update -qq
# Install ROS
- sudo apt-get install -y python-catkin-pkg python-catkin-tools python-rosdep python-wstool ros-$ROS_DISTRO-catkin
- source /opt/ros/$ROS_DISTRO/setup.bash
# Setup for rosdep
- sudo rosdep init
- rosdep update

# Create a catkin workspace with the package under test.
install:
- mkdir -p ~/catkin_ws/src

# Add the package under test to the workspace.
- cd ~/catkin_ws/src
- ln -s $CI_SOURCE_PATH . # Link the repo we are testing to the new workspace

- if [ $OPENCV_VERSION == 3 ]; then sed -i 's@libopencv-dev@opencv3@' $REPOSITORY_NAME/*/package.xml ; fi

# Install all dependencies, using wstool and rosdep.
# wstool looks for a ROSINSTALL_FILE defined in before_install.
before_script:
# source dependencies: install using wstool.
- cd ~/catkin_ws/src
- wstool init
- if [[ -f $ROSINSTALL_FILE ]] ; then wstool merge $ROSINSTALL_FILE ; fi
- wstool up

# package depdencies: install using rosdep.
- cd ~/catkin_ws
- rosdep install -q -y -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO

# Compile and test.
script:
- source /opt/ros/$ROS_DISTRO/setup.bash
- cd ~/catkin_ws
- catkin build -p1 -j1 --no-status
- catkin run_tests -p1 -j1
- catkin_test_results --all build
- catkin clean -b --yes
- catkin config --install
- catkin build -p1 -j1 --no-status
after_failure:
- find ${HOME}/.ros/test_results -type f -exec echo "== {} ==" \; -exec cat {} \;
- for file in ${HOME}/.ros/log/rostest-*; do echo "=== $file ==="; cat $file; done
@@ -0,0 +1,138 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package compressed_depth_image_transport
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1.9.5 (2016-10-03)
------------------
* disable -Werr
* Contributors: Vincent Rabaud

1.9.4 (2016-10-02)
------------------
* address gcc6 build error and tune
With gcc6, compiling fails with `stdlib.h: No such file or directory`,
as including '-isystem /usr/include' breaks with gcc6, cf.,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129.
This commit addresses this issue for this package in the same way
it was addressed in various other ROS packages. A list of related
commits and pull requests is at:
https://github.com/ros/rosdistro/issues/12783
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@oss.bmw-carit.de>
* Fix a missing return statement and add -Wall -Werror.
* Contributors: Lukas Bulwahn, Mac Mason

1.9.3 (2016-01-17)
------------------
* Refactor the codec into its own .h and .cpp.
* remove useless tf dependencies
* Contributors: Mac Mason, Vincent Rabaud

1.9.2 (2015-04-25)
------------------
* use compression parameters for both depths
fixes `#12 <https://github.com/ros-perception/image_transport_plugins/issues/12>`_
* get code to compile with OpenCV3
* Contributors: Vincent Rabaud

1.9.1 (2014-07-18)
------------------

1.9.0 (2014-05-16)
------------------

1.8.21 (2013-06-27)
-------------------
* maintainer: david gossow
* Contributors: David Gossow

1.8.20 (2013-03-18)
-------------------
* 1.8.19 -> 1.8.20
* Contributors: Julius Kammerl

1.8.19 (2013-02-24)
-------------------
* 1.8.18 -> 1.8.19
* Contributors: Julius Kammerl

1.8.18 (2013-02-07 17:59)
-------------------------
* 1.8.17 -> 1.8.18
* fixing input format checks (enabling rgba, bgra) + minor fixes
* Contributors: Julius Kammerl

1.8.17 (2013-01-18)
-------------------
* 1.8.16 -> 1.8.17
* Contributors: Julius Kammerl

1.8.16 (2013-01-17)
-------------------
* 1.8.15 -> 1.8.16
* use the pluginlib script to remove some runtime warnings
* Contributors: Julius Kammerl, Vincent Rabaud

1.8.15 (2012-12-28 20:11)
-------------------------

1.8.14 (2012-12-28 20:02)
-------------------------

1.8.13 (2012-12-28 19:06)
-------------------------
* fix the bad exports
* make sure the plugins are visible by image_transport
* added license headers to various cpp and h files
* Contributors: Aaron Blasdel, Vincent Rabaud

1.8.12 (2012-12-19 19:30)
-------------------------
* fix downstream stuff in cmake
* Contributors: Dirk Thomas

1.8.11 (2012-12-19 17:17)
-------------------------
* fix cmake order
* Contributors: Dirk Thomas

1.8.10 (2012-12-19 17:03)
-------------------------
* fix dyn reconf
* Contributors: Dirk Thomas

1.8.9 (2012-12-19 00:26)
------------------------
* switching to verion 1.8.9
* Contributors: Julius Kammerl

1.8.8 (2012-12-17)
------------------
* adding build_deb on message_generation & mrun_deb on message_runtime
* Updated package.xml for new buildtool_depend tag for catkin requirement
* Contributors: Julius Kammerl, mirzashah

1.8.7 (2012-12-10 15:29)
------------------------
* adding missing tf build dependency
* Contributors: Julius Kammerl

1.8.6 (2012-12-10 15:08)
------------------------
* switching to version 1.8.6
* Contributors: Julius Kammerl

1.8.5 (2012-12-09)
------------------
* adding missing build debs
* added class_loader_hide_library_symbols macros to CMakeList
* switching to 1.8.5
* Contributors: Julius Kammerl

1.8.4 (2012-11-30)
------------------
* switching to version 1.8.4
* adding plugin.xml exports for pluginlib
* catkinizing theora_image_transport
* catkinizing compressed_depth_image_transport
* github migration from code.ros.org (r40053)
* Contributors: Julius Kammerl
@@ -0,0 +1,40 @@
cmake_minimum_required(VERSION 2.8.3)
project(compressed_depth_image_transport)

if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
endif()

find_package(OpenCV REQUIRED)
find_package(catkin REQUIRED cv_bridge dynamic_reconfigure image_transport)

# generate the dynamic_reconfigure config file
generate_dynamic_reconfigure_options(cfg/CompressedDepthPublisher.cfg)

catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS cv_bridge dynamic_reconfigure image_transport
DEPENDS OpenCV
)

include_directories(include ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})

add_library(${PROJECT_NAME} src/compressed_depth_publisher.cpp src/compressed_depth_subscriber.cpp src/manifest.cpp src/codec.cpp)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_gencfg)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})

class_loader_hide_library_symbols(${PROJECT_NAME})

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

# add xml file
install(FILES compressed_depth_plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
@@ -0,0 +1,14 @@
#! /usr/bin/env python

PACKAGE='compressed_depth_image_transport'

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

gen.add("depth_max", double_t, 0, "Maximum depth value (meter) ", 10 , 1, 100)
gen.add("depth_quantization", double_t, 0, "Depth value at which the sensor accuracy is 1 m (Kinect: >75)", 100, 1, 150)
gen.add("png_level", int_t, 0, "PNG compression level", 9, 1, 9)


exit(gen.generate(PACKAGE, "CompressedDepthPublisher", "CompressedDepthPublisher"))
@@ -0,0 +1,13 @@
<library path="lib/libcompressed_depth_image_transport">
<class name="image_transport/compressedDepth_pub" type="compressed_depth_image_transport::CompressedDepthPublisher" base_class_type="image_transport::PublisherPlugin">
<description>
This plugin publishes a compressed depth images using PNG compression.
</description>
</class>

<class name="image_transport/compressedDepth_sub" type="compressed_depth_image_transport::CompressedDepthSubscriber" base_class_type="image_transport::SubscriberPlugin">
<description>
This plugin decodes a compressed depth images.
</description>
</class>
</library>
@@ -0,0 +1,57 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2012, Willow Garage.
* Copyright (c) 2016, Google, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/

#include <opencv2/core/core.hpp>

#include "sensor_msgs/CompressedImage.h"
#include "sensor_msgs/Image.h"
#include "sensor_msgs/image_encodings.h"

// Encoding and decoding of compressed depth images.
namespace compressed_depth_image_transport
{

// Returns a null pointer on bad input.
sensor_msgs::Image::Ptr decodeCompressedDepthImage(const sensor_msgs::CompressedImage& compressed_image);

// Compress a depth image. The png_compression parameter is passed straight through to
// OpenCV as IMWRITE_PNG_COMPRESSION. Returns a null pointer on bad input.
sensor_msgs::CompressedImage::Ptr encodeCompressedDepthImage(
const sensor_msgs::Image& message,
double depth_max,
double depth_quantization,
int png_level);

} // namespace compressed_depth_image_transport

0 comments on commit 86d9dc6

Please sign in to comment.