Skip to content
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

enable CI for the ROS2 branch #140

Open
wants to merge 5 commits into
base: ros2
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
68 changes: 68 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# continuous integration workflow
#
name: build repo

on:
push:
branches: [ros2]
pull_request:
branches: [ros2]
workflow_dispatch:
branches: [ros2]

jobs:
build_on_jammy:
name: build_jammy_${{ matrix.distro }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
distro: [humble, iron]
steps:
- uses: actions/checkout@v3
with:
path: src/${{ github.event.repository.name }}
fetch-depth: 0
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: ${{ matrix.distro }}
- uses: ros-tooling/[email protected]
with:
target-ros2-distro: ${{ matrix.distro }}
colcon-defaults: |
{
"build": {
"cmake-args": [
"-DCMAKE_BUILD_TYPE=RelWithDebInfo"
]
}
}
build_on_noble:
name: build_noble_${{ matrix.distro }}
runs-on: ubuntu-latest
container:
image: ubuntu:noble
strategy:
fail-fast: false
matrix:
distro: [jazzy, rolling]
steps:
- uses: actions/checkout@v3
with:
path: src/${{ github.event.repository.name }}
fetch-depth: 0
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: ${{ matrix.distro }}
- uses: ros-tooling/[email protected]
with:
target-ros2-distro: ${{ matrix.distro }}
colcon-defaults: |
{
"build": {
"cmake-args": [
"-DCMAKE_BUILD_TYPE=RelWithDebInfo"
]
}
}
1 change: 1 addition & 0 deletions vectornav/.clang-format
24 changes: 20 additions & 4 deletions vectornav/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.16)
project(vectornav)

# Default to C99
Expand Down Expand Up @@ -73,9 +73,25 @@ install(DIRECTORY
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
list(APPEND AMENT_LINT_AUTO_EXCLUDE ament_cmake_copyright)
find_package(ament_cmake REQUIRED)
# find_package(ament_cmake_copyright REQUIRED)
find_package(ament_cmake_cppcheck REQUIRED)
find_package(ament_cmake_cpplint REQUIRED)
find_package(ament_cmake_clang_format REQUIRED)
find_package(ament_cmake_flake8 REQUIRED)
find_package(ament_cmake_lint_cmake REQUIRED)
find_package(ament_cmake_pep257 REQUIRED)
find_package(ament_cmake_xmllint REQUIRED)

# ament_copyright()
ament_cppcheck(LANGUAGE c++)
ament_cpplint(FILTERS "-build/include,-runtime/indentation_namespace")
ament_clang_format(CONFIG_FILE .clang-format)
ament_flake8()
ament_lint_cmake()
ament_pep257()
ament_xmllint()

endif()

ament_export_dependencies(rosidl_default_runtime)
Expand Down
2 changes: 2 additions & 0 deletions vectornav/CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# which files to exclude
exclude_files=vnproglib-1.2.0.0
17 changes: 9 additions & 8 deletions vectornav/launch/vectornav.launch.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():

def generate_launch_description():
this_dir = get_package_share_directory('vectornav')

# Vectornav
start_vectornav_cmd = Node(
package='vectornav',
package='vectornav',
executable='vectornav',
output='screen',
parameters=[os.path.join(this_dir, 'config', 'vectornav.yaml')])

parameters=[os.path.join(this_dir, 'config', 'vectornav.yaml')],
)

start_vectornav_sensor_msgs_cmd = Node(
package='vectornav',
package='vectornav',
executable='vn_sensor_msgs',
output='screen',
parameters=[os.path.join(this_dir, 'config', 'vectornav.yaml')])
parameters=[os.path.join(this_dir, 'config', 'vectornav.yaml')],
)

# Create the launch description and populate
ld = LaunchDescription()
Expand Down
34 changes: 19 additions & 15 deletions vectornav/launch/vectornav_composable.launch.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@

#
# launch file for composable node container
#
from launch import LaunchDescription
from launch_ros.substitutions import FindPackageShare
from launch.substitutions import PathJoinSubstitution
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
from launch_ros.substitutions import FindPackageShare


def generate_launch_description():

con = ComposableNodeContainer(
name='vectornav_container',
namespace='',
Expand All @@ -21,22 +19,28 @@ def generate_launch_description():
package='vectornav',
plugin='vectornav::Vectornav',
name='vectornav',
parameters=[PathJoinSubstitution(
[FindPackageShare('vectornav'),
'config', 'vectornav_composable.yaml'])],
parameters=[
PathJoinSubstitution(
[FindPackageShare('vectornav'), 'config', 'vectornav_composable.yaml']
)
],
remappings=[],
extra_arguments=[{'use_intra_process_comms': True}]),
extra_arguments=[{'use_intra_process_comms': True}],
),
ComposableNode(
package='vectornav',
plugin='vectornav::VnSensorMsgs',
name='vn_sensor_msgs',
parameters=[PathJoinSubstitution(
[FindPackageShare('vectornav'),
'config', 'vn_sensor_msgs_composable.yaml'])],
parameters=[
PathJoinSubstitution(
[FindPackageShare('vectornav'), 'config', 'vn_sensor_msgs_composable.yaml']
)
],
remappings=[],
extra_arguments=[{'use_intra_process_comms': True}])
],
output='screen')

return LaunchDescription([con])
extra_arguments=[{'use_intra_process_comms': True}],
),
],
output='screen',
)

return LaunchDescription([con])
1 change: 1 addition & 0 deletions vectornav/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>ament_cmake_clang_format</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
14 changes: 9 additions & 5 deletions vectornav/src/vectornav.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
using namespace std::chrono_literals;
using namespace std::placeholders;

// Assure that the serial port is set to async low latency in order to reduce delays and package pilup.
// Assure that the serial port is set to async low latency in order
// to reduce delays and package pilup.
// These changes will stay effective until the device is unplugged

namespace vectornav
Expand Down Expand Up @@ -253,7 +254,8 @@ rclcpp_action::GoalResponse Vectornav::handle_cal_goal(
return rclcpp_action::GoalResponse::REJECT;
}

rclcpp_action::CancelResponse Vectornav::handle_cal_cancel(const std::shared_ptr<MagCalGH> goal_handle)
rclcpp_action::CancelResponse Vectornav::handle_cal_cancel(
const std::shared_ptr<MagCalGH> goal_handle)
{
RCLCPP_INFO(get_logger(), "Recieved request to stop magnetic calibration");

Expand Down Expand Up @@ -417,7 +419,7 @@ void Vectornav::execute_cal(const std::shared_ptr<MagCalGH> goal_handle)
loopRate.sleep();
}

//if we exited normally and are not cancelling
// if we exited normally and are not cancelling
if (!goal_handle->is_canceling()) {
// turn HSI mode to off to stop sampling
// turn HSI output to enabled
Expand All @@ -431,9 +433,11 @@ void Vectornav::execute_cal(const std::shared_ptr<MagCalGH> goal_handle)

// reconfigure IMU but do not save
// attempt reconfiguration of the device
// configure_sensor(); // ONLY FOR GDB DEBUGGING! THE BLOCK BELOW WILL HAVE NO EFFECT IF THIS IS LEFT
// re-instate the following line ONLY FOR GDB DEBUGGING!
// THE BLOCK BELOW WILL HAVE NO EFFECT IF THIS IS LEFT
// configure_sensor();
try {
// TODO Figure out why this will fail when called a second time
// TODO(Unknown) Figure out why this will fail when called a second time
configure_sensor();
} catch (const std::exception & e) {
RCLCPP_FATAL_STREAM(
Expand Down
Loading