diff --git a/.github/workflows/build-and-test.sh b/.github/workflows/build-and-test.sh new file mode 100755 index 0000000..3819462 --- /dev/null +++ b/.github/workflows/build-and-test.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -ev + +# Configuration. +export COLCON_WS=~/ws +export COLCON_WS_SRC=${COLCON_WS}/src +export DEBIAN_FRONTEND=noninteractive +export ROS_PYTHON_VERSION=3 + +apt update -qq +apt install -qq -y lsb-release wget curl build-essential + +# Dependencies. +echo "deb http://packages.ros.org/ros2-testing/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-testing.list +curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - +apt-get update -qq +apt-get install -y python3-colcon-common-extensions \ + python3-rosdep python3-vcstool python3-vcstools + +rosdep init +rosdep update +rosdep install --from-paths ./ -i -y -r --rosdistro $ROS_DISTRO $ROSDEP_ARGS + +# Build. +source /opt/ros/$ROS_DISTRO/setup.bash +mkdir -p $COLCON_WS_SRC +cp -r $GITHUB_WORKSPACE $COLCON_WS_SRC +cd $COLCON_WS +echo $1 +wget $1 +vcs import src < point_cloud_transport.repos +rosdep install --from-paths ./ -i -y -r --rosdistro $ROS_DISTRO $ROSDEP_ARGS +colcon build --event-handlers console_direct+ + +# Tests. +colcon test --event-handlers console_direct+ +colcon test-result diff --git a/.github/workflows/ros2-ci.yml b/.github/workflows/ros2-ci.yml new file mode 100644 index 0000000..3c3a880 --- /dev/null +++ b/.github/workflows/ros2-ci.yml @@ -0,0 +1,24 @@ +name: ROS2 CI + +on: [push, pull_request] + +jobs: + point_cloud_transport_ci: + name: point_cloud_transport CI + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - docker-image: "ubuntu:22.04" + ros-distro: "rolling" + container: + image: ${{ matrix.docker-image }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build and Test + run: .github/workflows/build-and-test.sh https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/point_cloud_transport.repos + env: + DOCKER_IMAGE: ${{ matrix.docker-image }} + ROS_DISTRO: ${{ matrix.ros-distro }} diff --git a/draco_point_cloud_transport/include/draco_point_cloud_transport/draco_publisher.hpp b/draco_point_cloud_transport/include/draco_point_cloud_transport/draco_publisher.hpp index 77316e0..6106b3f 100644 --- a/draco_point_cloud_transport/include/draco_point_cloud_transport/draco_publisher.hpp +++ b/draco_point_cloud_transport/include/draco_point_cloud_transport/draco_publisher.hpp @@ -74,7 +74,7 @@ class DracoPublisher class DracoPublisherConfig { - public: +public: int encode_speed = 7; int decode_speed = 7; int encode_method = 0; diff --git a/draco_point_cloud_transport/package.xml b/draco_point_cloud_transport/package.xml index ec51583..ec20ff3 100644 --- a/draco_point_cloud_transport/package.xml +++ b/draco_point_cloud_transport/package.xml @@ -18,7 +18,7 @@ draco pluginlib - draco + libdraco-dev pluginlib point_cloud_interfaces diff --git a/draco_point_cloud_transport/src/draco_publisher.cpp b/draco_point_cloud_transport/src/draco_publisher.cpp index 9c9c58c..e8af17f 100644 --- a/draco_point_cloud_transport/src/draco_publisher.cpp +++ b/draco_point_cloud_transport/src/draco_publisher.cpp @@ -85,7 +85,8 @@ void DracoPublisher::declareParameters(const std::string & base_topic) .set__from_value(0) .set__to_value(10) .set__step(1)}); - declareParam(encode_speed_paramDescriptor.name, config_.encode_speed, + declareParam( + encode_speed_paramDescriptor.name, config_.encode_speed, encode_speed_paramDescriptor); rcl_interfaces::msg::ParameterDescriptor decode_speed_paramDescriptor; @@ -98,7 +99,8 @@ void DracoPublisher::declareParameters(const std::string & base_topic) .set__from_value(0) .set__to_value(10) .set__step(1)}); - declareParam(decode_speed_paramDescriptor.name, config_.decode_speed, + declareParam( + decode_speed_paramDescriptor.name, config_.decode_speed, decode_speed_paramDescriptor); rcl_interfaces::msg::ParameterDescriptor encode_method_paramDescriptor; @@ -111,7 +113,8 @@ void DracoPublisher::declareParameters(const std::string & base_topic) .set__from_value(0) .set__to_value(2) .set__step(1)}); - declareParam(encode_method_paramDescriptor.name, config_.encode_method, + declareParam( + encode_method_paramDescriptor.name, config_.encode_method, encode_method_paramDescriptor); rcl_interfaces::msg::ParameterDescriptor deduplicate_paramDescriptor; diff --git a/point_cloud_transport.repos b/point_cloud_transport.repos new file mode 100644 index 0000000..e79282d --- /dev/null +++ b/point_cloud_transport.repos @@ -0,0 +1,5 @@ +repositories: + point_cloud_transport: + type: git + url: https://github.com/john-maidbot/point_cloud_transport + version: ros2