From a6974253700ddd1edbcacda0cfaf404e1c1cb00b Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Wed, 10 Apr 2024 13:49:18 -0400 Subject: [PATCH 01/18] Fixed linter errors --- .../clearpath_generator_robot/launch/generator.py | 10 +++++----- .../clearpath_generator_robot/launch/sensors.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py b/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py index 1a0d76e..285ba51 100644 --- a/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py +++ b/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py @@ -153,7 +153,7 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None: # Valence BMS self.bms_launch_file = None if (self.clearpath_config.platform.battery.model in - [BatteryConfig.VALENCE_U24_12XP, BatteryConfig.VALENCE_U27_12XP]): + [BatteryConfig.VALENCE_U24_12XP, BatteryConfig.VALENCE_U27_12XP]): can_dev = 'can1' bms_id = '0' @@ -161,10 +161,10 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None: launch_args = self.clearpath_config.platform.battery.launch_args if launch_args: - if 'can_device' in launch_args: - can_dev = launch_args['can_device'] - if 'bms_id' in launch_args: - bms_id = launch_args['bms_id'] + if 'can_device' in launch_args: + can_dev = launch_args['can_device'] + if 'bms_id' in launch_args: + bms_id = launch_args['bms_id'] bms_launch_args = [ ('namespace', self.namespace), diff --git a/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py b/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py index 9a2c05b..b1ff2b7 100644 --- a/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py +++ b/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py @@ -99,7 +99,7 @@ def generate(self): @property def namespace(self) -> str: - """Return sensor namespace""" + """Return sensor namespace.""" if self._robot_namespace in ('', '/'): return f'{self.SENSOR_NAMESPACE}/{self.sensor.name}' else: @@ -107,12 +107,12 @@ def namespace(self) -> str: @property def name(self) -> str: - """Return sensor name""" + """Return sensor name.""" return self.sensor.name @property def model(self) -> str: - """Return sensor model""" + """Return sensor model.""" return self.sensor.SENSOR_MODEL def __new__(cls, From 01605a820aa228c522edaa362652ed20ffd4bd43 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Wed, 10 Apr 2024 13:49:50 -0400 Subject: [PATCH 02/18] Added pytest to check config --- clearpath_generator_robot/CMakeLists.txt | 14 +++++ clearpath_generator_robot/package.xml | 1 + .../test/test_generator_launch.py | 55 +++++++++++++++++++ .../test/test_generator_param.py | 55 +++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 clearpath_generator_robot/test/test_generator_launch.py create mode 100644 clearpath_generator_robot/test/test_generator_param.py diff --git a/clearpath_generator_robot/CMakeLists.txt b/clearpath_generator_robot/CMakeLists.txt index 4eb9fa1..c3af6c7 100644 --- a/clearpath_generator_robot/CMakeLists.txt +++ b/clearpath_generator_robot/CMakeLists.txt @@ -27,6 +27,20 @@ if(BUILD_TESTING) # a copyright and license is added to all source files set(ament_cmake_cpplint_FOUND TRUE) ament_lint_auto_find_test_dependencies() + # pytest + find_package(ament_cmake_pytest REQUIRED) + set(_pytest_tests + test/test_generator_launch.py + test/test_generator_param.py + ) + foreach(_test_path ${_pytest_tests}) + get_filename_component(_test_name ${_test_path} NAME_WE) + ament_add_pytest_test(${_test_name} ${_test_path} + APPEND_ENV PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR} + TIMEOUT 60 + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + endforeach() endif() ament_package() diff --git a/clearpath_generator_robot/package.xml b/clearpath_generator_robot/package.xml index 9dc331b..d71ed48 100644 --- a/clearpath_generator_robot/package.xml +++ b/clearpath_generator_robot/package.xml @@ -22,6 +22,7 @@ ament_lint_auto ament_lint_common + ament_cmake_pytest ament_cmake diff --git a/clearpath_generator_robot/test/test_generator_launch.py b/clearpath_generator_robot/test/test_generator_launch.py new file mode 100644 index 0000000..e0b1396 --- /dev/null +++ b/clearpath_generator_robot/test/test_generator_launch.py @@ -0,0 +1,55 @@ +# Software License Agreement (BSD) +# +# @author Luis Camero +# @copyright (c) 2024, Clearpath Robotics, 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 Clearpath Robotics 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 HOLDER 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. +from clearpath_generator_robot.launch.generator import RobotLaunchGenerator +import os +import shutil + +SAMPLE_DIR = "/opt/ros/humble/share/clearpath_config/sample/" + + +class TestRobotLaunchGenerator: + + def test_samples(self): + errors = [] + for sample in os.listdir(SAMPLE_DIR): + # Create Clearpath Directory + src = os.path.join(SAMPLE_DIR, sample) + dst = os.path.join(os.environ["HOME"], ".clearpath", "robot.yaml") + shutil.rmtree(os.path.dirname(dst)) + os.makedirs(os.path.dirname(dst), exist_ok=True) + shutil.copy(src, dst) + # Generate + try: + rlg = RobotLaunchGenerator(os.path.dirname(dst)) + rlg.generate() + except Exception as e: + errors.append("Sample '%s' failed to load: '%s'" % ( + sample, + e.args[0], + )) + assert not errors, "Errors: %s" % "\n".join(errors) diff --git a/clearpath_generator_robot/test/test_generator_param.py b/clearpath_generator_robot/test/test_generator_param.py new file mode 100644 index 0000000..0988ad7 --- /dev/null +++ b/clearpath_generator_robot/test/test_generator_param.py @@ -0,0 +1,55 @@ +# Software License Agreement (BSD) +# +# @author Luis Camero +# @copyright (c) 2024, Clearpath Robotics, 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 Clearpath Robotics 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 HOLDER 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. +from clearpath_generator_robot.param.generator import RobotParamGenerator +import os +import shutil + +SAMPLE_DIR = "/opt/ros/humble/share/clearpath_config/sample/" + + +class TestRobotLaunchGenerator: + + def test_samples(self): + errors = [] + for sample in os.listdir(SAMPLE_DIR): + # Create Clearpath Directory + src = os.path.join(SAMPLE_DIR, sample) + dst = os.path.join(os.environ["HOME"], ".clearpath", "robot.yaml") + shutil.rmtree(os.path.dirname(dst)) + os.makedirs(os.path.dirname(dst), exist_ok=True) + shutil.copy(src, dst) + # Generate + try: + rpg = RobotParamGenerator(os.path.dirname(dst)) + rpg.generate() + except Exception as e: + errors.append("Sample '%s' failed to load: '%s'" % ( + sample, + e.args[0], + )) + assert not errors, "Errors: %s" % "\n".join(errors) From 898a7124bd2c8fa2f8bc966b9085c01d3d4a2f41 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Wed, 10 Apr 2024 14:10:33 -0400 Subject: [PATCH 03/18] Added more packages to CI --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e12c327..120cf9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,5 +20,9 @@ jobs: with: target-ros2-distro: humble - package-name: clearpath_robot + package-name: | + clearpath_diagnostics + clearpath_generator_robot + clearpath_robot + clearpath_sensors vcs-repo-file-url: dependencies.repos From 7db41cc0cf16b374624a5a76ad7ac36f3313e178 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Wed, 10 Apr 2024 15:49:57 -0400 Subject: [PATCH 04/18] Fixed linting errors --- clearpath_diagnostics/CMakeLists.txt | 8 ++++---- .../clearpath_diagnostics/battery_state/battery.py | 3 ++- .../clearpath_generator_robot/launch/generator.py | 2 +- .../clearpath_generator_robot/launch/sensors.py | 5 ++--- clearpath_generator_robot/test/test_generator_launch.py | 9 +++++---- clearpath_generator_robot/test/test_generator_param.py | 9 +++++---- clearpath_sensors/launch/flir_blackfly.launch.py | 4 ++-- .../launch/image_compressed_to_raw.launch.py | 6 +++--- .../launch/image_raw_to_compressed.launch.py | 6 +++--- clearpath_sensors/launch/image_raw_to_theora.launch.py | 6 +++--- clearpath_sensors/launch/image_rectify.launch.py | 2 +- clearpath_sensors/launch/image_resize.launch.py | 2 +- clearpath_sensors/launch/image_theora_to_raw.launch.py | 6 +++--- 13 files changed, 35 insertions(+), 33 deletions(-) diff --git a/clearpath_diagnostics/CMakeLists.txt b/clearpath_diagnostics/CMakeLists.txt index c47ea8d..db672ca 100644 --- a/clearpath_diagnostics/CMakeLists.txt +++ b/clearpath_diagnostics/CMakeLists.txt @@ -11,10 +11,10 @@ find_package(ament_cmake_python REQUIRED) ament_python_install_package(${PROJECT_NAME}) -install( - PROGRAMS ${PROJECT_NAME}/diagnostics_updater - ${PROJECT_NAME}/battery_state/battery_state_estimator - ${PROJECT_NAME}/battery_state/battery_state_control +install(PROGRAMS + ${PROJECT_NAME}/diagnostics_updater + ${PROJECT_NAME}/battery_state/battery_state_estimator + ${PROJECT_NAME}/battery_state/battery_state_control DESTINATION lib/${PROJECT_NAME} ) diff --git a/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py b/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py index 2a8d9d9..ee035d6 100644 --- a/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py +++ b/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py @@ -43,7 +43,7 @@ class Battery: class BaseBattery: - """ Base Battery class. """ + """Base Battery class.""" """Battery configuration. Represents number of battery cells in series and parallel.""" CONFIGURATIONS = { @@ -189,6 +189,7 @@ def update_cells(self): class LiION(BaseBattery): """Base Lithium ION battery.""" + LUT = [] def __init__( diff --git a/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py b/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py index 285ba51..2960489 100644 --- a/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py +++ b/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py @@ -34,8 +34,8 @@ from clearpath_config.platform.battery import BatteryConfig from clearpath_generator_common.common import LaunchFile, Package -from clearpath_generator_common.launch.writer import LaunchWriter from clearpath_generator_common.launch.generator import LaunchGenerator +from clearpath_generator_common.launch.writer import LaunchWriter from clearpath_generator_robot.launch.sensors import SensorLaunch from clearpath_config.common.types.platform import Platform diff --git a/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py b/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py index b1ff2b7..5c9abaa 100644 --- a/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py +++ b/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py @@ -29,9 +29,8 @@ # Redistribution and use in source and binary forms, with or without # modification, is not permitted without the express permission # of Clearpath Robotics. - -from clearpath_config.sensors.types.sensor import BaseSensor from clearpath_config.sensors.types.cameras import BaseCamera +from clearpath_config.sensors.types.sensor import BaseSensor from clearpath_generator_common.common import LaunchFile, Package, ParamFile from clearpath_generator_common.launch.writer import LaunchWriter @@ -84,7 +83,7 @@ def generate(self): if self.sensor.get_sensor_type() == BaseCamera.get_sensor_type(): for republihser in self.sensor._republishers: sensor_writer.add(LaunchFile( - "image_%s" % republihser.TYPE, + 'image_%s' % republihser.TYPE, package=self.CLEARPATH_SENSORS_PACKAGE, args=[ (self.NAMESPACE, self.namespace), diff --git a/clearpath_generator_robot/test/test_generator_launch.py b/clearpath_generator_robot/test/test_generator_launch.py index e0b1396..6745a39 100644 --- a/clearpath_generator_robot/test/test_generator_launch.py +++ b/clearpath_generator_robot/test/test_generator_launch.py @@ -25,11 +25,12 @@ # 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. -from clearpath_generator_robot.launch.generator import RobotLaunchGenerator import os import shutil -SAMPLE_DIR = "/opt/ros/humble/share/clearpath_config/sample/" +from clearpath_generator_robot.launch.generator import RobotLaunchGenerator + +SAMPLE_DIR = '/opt/ros/humble/share/clearpath_config/sample/' class TestRobotLaunchGenerator: @@ -39,7 +40,7 @@ def test_samples(self): for sample in os.listdir(SAMPLE_DIR): # Create Clearpath Directory src = os.path.join(SAMPLE_DIR, sample) - dst = os.path.join(os.environ["HOME"], ".clearpath", "robot.yaml") + dst = os.path.join(os.environ['HOME'], '.clearpath', 'robot.yaml') shutil.rmtree(os.path.dirname(dst)) os.makedirs(os.path.dirname(dst), exist_ok=True) shutil.copy(src, dst) @@ -52,4 +53,4 @@ def test_samples(self): sample, e.args[0], )) - assert not errors, "Errors: %s" % "\n".join(errors) + assert not errors, 'Errors: %s' % '\n'.join(errors) diff --git a/clearpath_generator_robot/test/test_generator_param.py b/clearpath_generator_robot/test/test_generator_param.py index 0988ad7..c260477 100644 --- a/clearpath_generator_robot/test/test_generator_param.py +++ b/clearpath_generator_robot/test/test_generator_param.py @@ -25,11 +25,12 @@ # 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. -from clearpath_generator_robot.param.generator import RobotParamGenerator import os import shutil -SAMPLE_DIR = "/opt/ros/humble/share/clearpath_config/sample/" +from clearpath_generator_robot.param.generator import RobotParamGenerator + +SAMPLE_DIR = '/opt/ros/humble/share/clearpath_config/sample/' class TestRobotLaunchGenerator: @@ -39,7 +40,7 @@ def test_samples(self): for sample in os.listdir(SAMPLE_DIR): # Create Clearpath Directory src = os.path.join(SAMPLE_DIR, sample) - dst = os.path.join(os.environ["HOME"], ".clearpath", "robot.yaml") + dst = os.path.join(os.environ['HOME'], '.clearpath', 'robot.yaml') shutil.rmtree(os.path.dirname(dst)) os.makedirs(os.path.dirname(dst), exist_ok=True) shutil.copy(src, dst) @@ -52,4 +53,4 @@ def test_samples(self): sample, e.args[0], )) - assert not errors, "Errors: %s" % "\n".join(errors) + assert not errors, 'Errors: %s' % '\n'.join(errors) diff --git a/clearpath_sensors/launch/flir_blackfly.launch.py b/clearpath_sensors/launch/flir_blackfly.launch.py index 7de75be..34d1f95 100644 --- a/clearpath_sensors/launch/flir_blackfly.launch.py +++ b/clearpath_sensors/launch/flir_blackfly.launch.py @@ -28,7 +28,7 @@ from launch import LaunchDescription from launch.actions import DeclareLaunchArgument from launch.substitutions import LaunchConfiguration, PathJoinSubstitution -from launch_ros.actions import Node, ComposableNodeContainer +from launch_ros.actions import ComposableNodeContainer, Node from launch_ros.descriptions import ComposableNode from launch_ros.substitutions import FindPackageShare @@ -58,7 +58,7 @@ def generate_launch_description(): 'namespace', default_value='sensors/camera_0') - name = "flir_blackfly" + name = 'flir_blackfly' blackfly_camera_node = Node( package='spinnaker_camera_driver', namespace=namespace, diff --git a/clearpath_sensors/launch/image_compressed_to_raw.launch.py b/clearpath_sensors/launch/image_compressed_to_raw.launch.py index 05b50fa..9e644a3 100644 --- a/clearpath_sensors/launch/image_compressed_to_raw.launch.py +++ b/clearpath_sensors/launch/image_compressed_to_raw.launch.py @@ -52,10 +52,10 @@ def generate_launch_description(): ) compressed_transport_node = Node( - name="image_compressed_to_raw", + name='image_compressed_to_raw', namespace=namespace, - package="image_transport", - executable="republish", + package='image_transport', + executable='republish', remappings=[ ('in/compressed', in_compressed), ('out', out_raw), diff --git a/clearpath_sensors/launch/image_raw_to_compressed.launch.py b/clearpath_sensors/launch/image_raw_to_compressed.launch.py index 0e3ae72..f3bd0c1 100644 --- a/clearpath_sensors/launch/image_raw_to_compressed.launch.py +++ b/clearpath_sensors/launch/image_raw_to_compressed.launch.py @@ -52,10 +52,10 @@ def generate_launch_description(): ) compressed_transport_node = Node( - name="image_raw_to_compressed", + name='image_raw_to_compressed', namespace=namespace, - package="image_transport", - executable="republish", + package='image_transport', + executable='republish', remappings=[ ('in', in_raw), ('out/compressed', out_compressed), diff --git a/clearpath_sensors/launch/image_raw_to_theora.launch.py b/clearpath_sensors/launch/image_raw_to_theora.launch.py index 74e9d81..9c0a18d 100644 --- a/clearpath_sensors/launch/image_raw_to_theora.launch.py +++ b/clearpath_sensors/launch/image_raw_to_theora.launch.py @@ -52,10 +52,10 @@ def generate_launch_description(): ) theora_transport_node = Node( - name="image_raw_to_theora", + name='image_raw_to_theora', namespace=namespace, - package="image_transport", - executable="republish", + package='image_transport', + executable='republish', remappings=[ ('in', in_raw), ('out/theora', out_theora), diff --git a/clearpath_sensors/launch/image_rectify.launch.py b/clearpath_sensors/launch/image_rectify.launch.py index 3cb5b8d..f513182 100644 --- a/clearpath_sensors/launch/image_rectify.launch.py +++ b/clearpath_sensors/launch/image_rectify.launch.py @@ -102,7 +102,7 @@ def generate_launch_description(): load_composable_nodes = LoadComposableNodes( condition=LaunchConfigurationNotEquals('container', ''), composable_node_descriptions=composable_nodes, - target_container=PythonExpression(["'", namespace, "/", container, "'"]) + target_container=PythonExpression(["'", namespace, '/', container, "'"]) ) ld = LaunchDescription() diff --git a/clearpath_sensors/launch/image_resize.launch.py b/clearpath_sensors/launch/image_resize.launch.py index 3fb76a1..42ebd36 100644 --- a/clearpath_sensors/launch/image_resize.launch.py +++ b/clearpath_sensors/launch/image_resize.launch.py @@ -102,7 +102,7 @@ def generate_launch_description(): load_composable_nodes = LoadComposableNodes( condition=LaunchConfigurationNotEquals('container', ''), composable_node_descriptions=composable_nodes, - target_container=PythonExpression(["'", namespace, "/", container, "'"]) + target_container=PythonExpression(["'", namespace, '/', container, "'"]) ) ld = LaunchDescription() diff --git a/clearpath_sensors/launch/image_theora_to_raw.launch.py b/clearpath_sensors/launch/image_theora_to_raw.launch.py index 0795e28..dc181fb 100644 --- a/clearpath_sensors/launch/image_theora_to_raw.launch.py +++ b/clearpath_sensors/launch/image_theora_to_raw.launch.py @@ -52,10 +52,10 @@ def generate_launch_description(): ) theora_transport_node = Node( - name="image_theora_to_raw", + name='image_theora_to_raw', namespace=namespace, - package="image_transport", - executable="republish", + package='image_transport', + executable='republish', remappings=[ ('in/theora', in_theora), ('out', out_raw), From 2605509bd3853951af7a4930adc2cec63f62a42a Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Wed, 10 Apr 2024 16:24:41 -0400 Subject: [PATCH 05/18] More linting changes --- .../battery_state/battery.py | 1 - .../launch/generator.py | 9 +- .../launch/sensors.py | 145 ++++++++---------- .../param/generator.py | 1 + .../param/sensors.py | 104 ++++++------- 5 files changed, 123 insertions(+), 137 deletions(-) diff --git a/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py b/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py index ee035d6..78b610f 100644 --- a/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py +++ b/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py @@ -102,7 +102,6 @@ def __init__( self.power_msg_voltage_index = Power.D150_MEASURED_BATTERY self.power_msg_current_index = Power.D150_TOTAL_CURRENT - # System capacity self._msg.capacity = self._msg.design_capacity = self.system_capacity diff --git a/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py b/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py index 2960489..8813842 100644 --- a/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py +++ b/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py @@ -31,19 +31,18 @@ # Redistribution and use in source and binary forms, with or without # modification, is not permitted without the express permission # of Clearpath Robotics. +import os +from clearpath_config.common.types.platform import Platform from clearpath_config.platform.battery import BatteryConfig from clearpath_generator_common.common import LaunchFile, Package from clearpath_generator_common.launch.generator import LaunchGenerator from clearpath_generator_common.launch.writer import LaunchWriter from clearpath_generator_robot.launch.sensors import SensorLaunch -from clearpath_config.common.types.platform import Platform - -import os - class RobotLaunchGenerator(LaunchGenerator): + def __init__(self, setup_path: str = '/etc/clearpath/') -> None: super().__init__(setup_path) @@ -72,7 +71,7 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None: name='configure_mcu', cmd=[ ['export ROS_DOMAIN_ID=0;'], - [LaunchFile.Variable('FindExecutable(name=\'ros2\')'), + [LaunchFile.Variable("FindExecutable(name='ros2')"), ' service call platform/mcu/configure', ' clearpath_platform_msgs/srv/ConfigureMcu', ' \"{{domain_id: {0},'.format(self.clearpath_config.system.domain_id), diff --git a/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py b/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py index 5c9abaa..35297c0 100644 --- a/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py +++ b/clearpath_generator_robot/clearpath_generator_robot/launch/sensors.py @@ -37,90 +37,81 @@ class SensorLaunch(): - class BaseLaunch(): - CLEARPATH_SENSORS = 'clearpath_sensors' - SENSOR_NAMESPACE = 'sensors' - CLEARPATH_SENSORS_PACKAGE = Package(CLEARPATH_SENSORS) - # Launch arguments - PARAMETERS = 'parameters' - NAMESPACE = 'namespace' - # Republish arguments - INPUT = 'input_ns' - OUTPUT = 'output_ns' - CONTAINER = 'container' + CLEARPATH_SENSORS = 'clearpath_sensors' + SENSOR_NAMESPACE = 'sensors' + CLEARPATH_SENSORS_PACKAGE = Package(CLEARPATH_SENSORS) - def __init__(self, - sensor: BaseSensor, - robot_namespace: str, - launch_path: str, - param_path: str) -> None: - self.sensor = sensor - self._robot_namespace = robot_namespace - self.parameters = ParamFile(self.name, path=param_path) + # Launch arguments + PARAMETERS = 'parameters' + NAMESPACE = 'namespace' + # Republish arguments + INPUT = 'input_ns' + OUTPUT = 'output_ns' + CONTAINER = 'container' - # Generated launch file - self.launch_file = LaunchFile( - self.name, - path=launch_path) + def __init__( + self, + sensor: BaseSensor, + robot_namespace: str, + launch_path: str, + param_path: str + ) -> None: + self.sensor = sensor + self._robot_namespace = robot_namespace + self.parameters = ParamFile(self.name, path=param_path) - # Set launch args for default launch file - self.launch_args = [ - (self.PARAMETERS, self.parameters.full_path), - (self.NAMESPACE, self.namespace) - ] + # Generated launch file + self.launch_file = LaunchFile( + self.name, + path=launch_path) - self.default_sensor_launch_file = LaunchFile( - self.model, - package=self.CLEARPATH_SENSORS_PACKAGE, - args=self.launch_args) + # Set launch args for default launch file + self.launch_args = [ + (self.PARAMETERS, self.parameters.full_path), + (self.NAMESPACE, self.namespace) + ] - def generate(self): - sensor_writer = LaunchWriter(self.launch_file) - # Add default sensor launch file - sensor_writer.add(self.default_sensor_launch_file) - # Cameras republishers - if self.sensor.get_sensor_type() == BaseCamera.get_sensor_type(): - for republihser in self.sensor._republishers: - sensor_writer.add(LaunchFile( - 'image_%s' % republihser.TYPE, - package=self.CLEARPATH_SENSORS_PACKAGE, - args=[ - (self.NAMESPACE, self.namespace), - (self.PARAMETERS, self.parameters.full_path), - (self.INPUT, republihser.input), - (self.OUTPUT, republihser.output), - (self.CONTAINER, 'image_processing_container') - ] - )) - # Generate sensor launch file - sensor_writer.generate_file() + self.default_sensor_launch_file = LaunchFile( + self.model, + package=self.CLEARPATH_SENSORS_PACKAGE, + args=self.launch_args) - @property - def namespace(self) -> str: - """Return sensor namespace.""" - if self._robot_namespace in ('', '/'): - return f'{self.SENSOR_NAMESPACE}/{self.sensor.name}' - else: - return f'{self._robot_namespace}/{self.SENSOR_NAMESPACE}/{self.sensor.name}' + def generate(self): + sensor_writer = LaunchWriter(self.launch_file) + # Add default sensor launch file + sensor_writer.add(self.default_sensor_launch_file) + # Cameras republishers + if self.sensor.get_sensor_type() == BaseCamera.get_sensor_type(): + for republihser in self.sensor._republishers: + sensor_writer.add(LaunchFile( + 'image_%s' % republihser.TYPE, + package=self.CLEARPATH_SENSORS_PACKAGE, + args=[ + (self.NAMESPACE, self.namespace), + (self.PARAMETERS, self.parameters.full_path), + (self.INPUT, republihser.input), + (self.OUTPUT, republihser.output), + (self.CONTAINER, 'image_processing_container') + ] + )) + # Generate sensor launch file + sensor_writer.generate_file() - @property - def name(self) -> str: - """Return sensor name.""" - return self.sensor.name + @property + def namespace(self) -> str: + """Return sensor namespace.""" + if self._robot_namespace in ('', '/'): + return f'{self.SENSOR_NAMESPACE}/{self.sensor.name}' + else: + return f'{self._robot_namespace}/{self.SENSOR_NAMESPACE}/{self.sensor.name}' - @property - def model(self) -> str: - """Return sensor model.""" - return self.sensor.SENSOR_MODEL + @property + def name(self) -> str: + """Return sensor name.""" + return self.sensor.name - def __new__(cls, - sensor: BaseSensor, - robot_namespace: str, - launch_path: str, - param_path: str) -> BaseLaunch: - return SensorLaunch.BaseLaunch( - sensor, - robot_namespace, - launch_path, - param_path) + @property + def model(self) -> str: + """Return sensor model.""" + return self.sensor.SENSOR_MODEL diff --git a/clearpath_generator_robot/clearpath_generator_robot/param/generator.py b/clearpath_generator_robot/clearpath_generator_robot/param/generator.py index 637a56a..1e55a30 100644 --- a/clearpath_generator_robot/clearpath_generator_robot/param/generator.py +++ b/clearpath_generator_robot/clearpath_generator_robot/param/generator.py @@ -37,6 +37,7 @@ class RobotParamGenerator(ParamGenerator): + def generate_sensors(self) -> None: sensors = self.clearpath_config.sensors.get_all_sensors() for sensor in sensors: diff --git a/clearpath_generator_robot/clearpath_generator_robot/param/sensors.py b/clearpath_generator_robot/clearpath_generator_robot/param/sensors.py index 8db7754..5e4461f 100644 --- a/clearpath_generator_robot/clearpath_generator_robot/param/sensors.py +++ b/clearpath_generator_robot/clearpath_generator_robot/param/sensors.py @@ -30,73 +30,69 @@ # modification, is not permitted without the express permission # of Clearpath Robotics. -from clearpath_config.sensors.types.sensor import BaseSensor -from clearpath_config.sensors.types.cameras import BaseCamera from clearpath_config.common.utils.dictionary import merge_dict +from clearpath_config.sensors.types.cameras import BaseCamera +from clearpath_config.sensors.types.sensor import BaseSensor -from clearpath_generator_common.common import ParamFile, Package +from clearpath_generator_common.common import Package, ParamFile from clearpath_generator_common.param.writer import ParamWriter class SensorParam(): - class BaseParam(): - CLEARPATH_SENSORS = 'clearpath_sensors' - TOPIC_NAMESPACE = 'sensors' + CLEARPATH_SENSORS = 'clearpath_sensors' - def __init__(self, - sensor: BaseSensor, - namespace: str, - param_path: str) -> None: - self.sensor = sensor - self.param_path = param_path - if namespace in ('', '/'): - self.namespace = f'{self.TOPIC_NAMESPACE}/{self.sensor.name}' - else: - self.namespace = f'{namespace}/{self.TOPIC_NAMESPACE}/{self.sensor.name}' + TOPIC_NAMESPACE = 'sensors' - # Clearpath Sensors Package - self.clearpath_sensors_package = Package(self.CLEARPATH_SENSORS) + def __init__( + self, + sensor: BaseSensor, + namespace: str, + param_path: str + ) -> None: + self.sensor = sensor + self.param_path = param_path + if namespace in ('', '/'): + self.namespace = f'{self.TOPIC_NAMESPACE}/{self.sensor.name}' + else: + self.namespace = f'{namespace}/{self.TOPIC_NAMESPACE}/{self.sensor.name}' - # Default parameter file for the sensor - self.default_param_file = ParamFile( - name=self.sensor.get_sensor_model(), - package=self.clearpath_sensors_package, - parameters={}) - self.default_param_file.read() + # Clearpath Sensors Package + self.clearpath_sensors_package = Package(self.CLEARPATH_SENSORS) - default_parameters = self.default_param_file.parameters + # Default parameter file for the sensor + self.default_param_file = ParamFile( + name=self.sensor.get_sensor_model(), + package=self.clearpath_sensors_package, + parameters={}) + self.default_param_file.read() - # Camera republishers - if self.sensor.get_sensor_type() == BaseCamera.get_sensor_type(): - for republisher in self.sensor._republishers: - name = "image_%s" % republisher.TYPE - rename = "image_%s_%s" % (republisher.TYPE, republisher.input) - republisher_file = ParamFile( - name=name, - package=self.clearpath_sensors_package, - parameters={}) - republisher_file.read() - republisher_file.parameters[rename] = republisher_file.parameters.pop(name) - default_parameters = merge_dict(default_parameters, - republisher_file.parameters) + default_parameters = self.default_param_file.parameters - # Parameter file to generate - self.param_file = ParamFile( - name=self.sensor.name, - namespace=self.namespace, - path=self.param_path, - parameters=default_parameters) + # Camera republishers + if self.sensor.get_sensor_type() == BaseCamera.get_sensor_type(): + for republisher in self.sensor._republishers: + name = 'image_%s' % republisher.TYPE + rename = 'image_%s_%s' % (republisher.TYPE, republisher.input) + republisher_file = ParamFile( + name=name, + package=self.clearpath_sensors_package, + parameters={}) + republisher_file.read() + republisher_file.parameters[rename] = republisher_file.parameters.pop(name) + default_parameters = merge_dict(default_parameters, + republisher_file.parameters) - self.param_file.update(self.sensor.get_ros_parameters()) + # Parameter file to generate + self.param_file = ParamFile( + name=self.sensor.name, + namespace=self.namespace, + path=self.param_path, + parameters=default_parameters) - def generate_config(self): - sensor_writer = ParamWriter(self.param_file) - sensor_writer.write_file() - print('Generated config: {0}'.format(self.param_file.full_path)) + self.param_file.update(self.sensor.get_ros_parameters()) - def __new__(cls, - sensor: BaseSensor, - namespace: str, - param_path: str) -> BaseParam: - return SensorParam.BaseParam(sensor, namespace, param_path) + def generate_config(self): + sensor_writer = ParamWriter(self.param_file) + sensor_writer.write_file() + print('Generated config: {0}'.format(self.param_file.full_path)) From 7081eb2f597b5f5b75557762ff155547ea3e0593 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Thu, 11 Apr 2024 12:07:10 -0400 Subject: [PATCH 06/18] Increment version of setup-ros action --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 120cf9f..365a1f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - uses: ros-tooling/setup-ros@v0.6 + - uses: ros-tooling/setup-ros@v0.7 with: required-ros-distributions: humble - uses: ros-tooling/action-ros-ci@v0.3 From f70ff52446eadd1e87daec5f2e7e724b410b53c9 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Thu, 11 Apr 2024 12:40:30 -0400 Subject: [PATCH 07/18] Even more lint errors --- .../battery_state/battery.py | 9 ++--- .../launch/diagnostics.launch.py | 40 +++++++++---------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py b/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py index 78b610f..6ec709b 100644 --- a/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py +++ b/clearpath_diagnostics/clearpath_diagnostics/battery_state/battery.py @@ -29,18 +29,15 @@ # Redistribution and use in source and binary forms, with or without # modification, is not permitted without the express permission # of Clearpath Robotics. - -from clearpath_platform_msgs.msg import Power -from sensor_msgs.msg import BatteryState +from math import nan from clearpath_config.common.types.platform import Platform from clearpath_config.platform.battery import BatteryConfig - -from math import nan +from clearpath_platform_msgs.msg import Power +from sensor_msgs.msg import BatteryState # Base Battery - class Battery: class BaseBattery: """Base Battery class.""" diff --git a/clearpath_diagnostics/launch/diagnostics.launch.py b/clearpath_diagnostics/launch/diagnostics.launch.py index 4395465..5d4bf01 100644 --- a/clearpath_diagnostics/launch/diagnostics.launch.py +++ b/clearpath_diagnostics/launch/diagnostics.launch.py @@ -34,8 +34,8 @@ from ament_index_python.packages import get_package_share_directory -from clearpath_config.common.utils.yaml import read_yaml from clearpath_config.clearpath_config import ClearpathConfig +from clearpath_config.common.utils.yaml import read_yaml from launch import LaunchDescription from launch.actions import ( @@ -50,24 +50,24 @@ ARGUMENTS = [ DeclareLaunchArgument( - "setup_path", - default_value="/etc/clearpath/", - description="Clearpath setup path", + 'setup_path', + default_value='/etc/clearpath/', + description='Clearpath setup path', ) ] def launch_setup(context, *args, **kwargs): - pkg_clearpath_diagnostics = get_package_share_directory("clearpath_diagnostics") + pkg_clearpath_diagnostics = get_package_share_directory('clearpath_diagnostics') - setup_path = LaunchConfiguration("setup_path") + setup_path = LaunchConfiguration('setup_path') analyzer_params_filepath = PathJoinSubstitution( - [pkg_clearpath_diagnostics, "config", "diagnostics.yaml"] + [pkg_clearpath_diagnostics, 'config', 'diagnostics.yaml'] ) # Read robot YAML - config = read_yaml(setup_path.perform(context) + "robot.yaml") + config = read_yaml(setup_path.perform(context) + 'robot.yaml') # Parse robot YAML into config clearpath_config = ClearpathConfig(config) @@ -77,25 +77,25 @@ def launch_setup(context, *args, **kwargs): PushRosNamespace(namespace), # Aggregator Node( - package="diagnostic_aggregator", - executable="aggregator_node", - output="screen", + package='diagnostic_aggregator', + executable='aggregator_node', + output='screen', parameters=[analyzer_params_filepath], remappings=[ - ("/diagnostics", "diagnostics"), - ("/diagnostics_agg", "diagnostics_agg"), - ("/diagnostics_toplevel_state", "diagnostics_toplevel_state"), + ('/diagnostics', 'diagnostics'), + ('/diagnostics_agg', 'diagnostics_agg'), + ('/diagnostics_toplevel_state', 'diagnostics_toplevel_state'), ], ), # Updater Node( - package="clearpath_diagnostics", - executable="diagnostics_updater", - output="screen", + package='clearpath_diagnostics', + executable='diagnostics_updater', + output='screen', remappings=[ - ("/diagnostics", "diagnostics"), - ("/diagnostics_agg", "diagnostics_agg"), - ("/diagnostics_toplevel_state", "diagnostics_toplevel_state"), + ('/diagnostics', 'diagnostics'), + ('/diagnostics_agg', 'diagnostics_agg'), + ('/diagnostics_toplevel_state', 'diagnostics_toplevel_state'), ], arguments=['-s', setup_path] ), From 1c9679b1919cb642e9e29e9e9c27e4b4ce138cdb Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Thu, 11 Apr 2024 12:40:50 -0400 Subject: [PATCH 08/18] Ignore error from deleting clearpath temp folder --- clearpath_generator_robot/test/test_generator_launch.py | 2 +- clearpath_generator_robot/test/test_generator_param.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clearpath_generator_robot/test/test_generator_launch.py b/clearpath_generator_robot/test/test_generator_launch.py index 6745a39..64068cc 100644 --- a/clearpath_generator_robot/test/test_generator_launch.py +++ b/clearpath_generator_robot/test/test_generator_launch.py @@ -41,7 +41,7 @@ def test_samples(self): # Create Clearpath Directory src = os.path.join(SAMPLE_DIR, sample) dst = os.path.join(os.environ['HOME'], '.clearpath', 'robot.yaml') - shutil.rmtree(os.path.dirname(dst)) + shutil.rmtree(os.path.dirname(dst), ignore_errors=True) os.makedirs(os.path.dirname(dst), exist_ok=True) shutil.copy(src, dst) # Generate diff --git a/clearpath_generator_robot/test/test_generator_param.py b/clearpath_generator_robot/test/test_generator_param.py index c260477..689e43b 100644 --- a/clearpath_generator_robot/test/test_generator_param.py +++ b/clearpath_generator_robot/test/test_generator_param.py @@ -41,7 +41,7 @@ def test_samples(self): # Create Clearpath Directory src = os.path.join(SAMPLE_DIR, sample) dst = os.path.join(os.environ['HOME'], '.clearpath', 'robot.yaml') - shutil.rmtree(os.path.dirname(dst)) + shutil.rmtree(os.path.dirname(dst), ignore_errors=True) os.makedirs(os.path.dirname(dst), exist_ok=True) shutil.copy(src, dst) # Generate From 148d5f4f2fdd554a754bf4bd0207e8e3ab2804aa Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Thu, 11 Apr 2024 13:21:23 -0400 Subject: [PATCH 09/18] Add clearpath-package-server --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 365a1f8..e6a6571 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,11 +15,17 @@ jobs: - uses: ros-tooling/setup-ros@v0.7 with: required-ros-distributions: humble + - name: clearpath-package-server + run: | + cat /home/runner/work/clearpath_robot/clearpath_robot/ros.key + sudo apt install wget + wget https://packages.clearpathrobotics.com/public.key -O - | sudo apt-key add - + sudo sh -c 'echo "deb https://packages.clearpathrobotics.com/stable/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/clearpath-latest.list' + sudo apt-get update - uses: ros-tooling/action-ros-ci@v0.3 id: action_ros_ci_step with: target-ros2-distro: humble - package-name: | clearpath_diagnostics clearpath_generator_robot From de6e4422b51391c1ce275c8f6bd0e4f2e7a1487d Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Thu, 11 Apr 2024 13:28:25 -0400 Subject: [PATCH 10/18] Removed key check --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6a6571..c258d7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,6 @@ jobs: required-ros-distributions: humble - name: clearpath-package-server run: | - cat /home/runner/work/clearpath_robot/clearpath_robot/ros.key sudo apt install wget wget https://packages.clearpathrobotics.com/public.key -O - | sudo apt-key add - sudo sh -c 'echo "deb https://packages.clearpathrobotics.com/stable/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/clearpath-latest.list' From 9ffbfd13b565ce588f984ff4141a5db4bcacf98e Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Thu, 11 Apr 2024 17:23:28 -0400 Subject: [PATCH 11/18] Three CI jobs --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++-- clearpath_robot.repos | 5 +++++ dependencies.repos | 8 ++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 clearpath_robot.repos diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c258d7a..df81eec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,26 @@ on: - cron: "0 0 * * *" # every day at midnight jobs: - clearpath_robot_ci: - name: Humble + clearpath_robot_osrf_ci: + name: Humble OSRF Release + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: ros-tooling/setup-ros@v0.7 + with: + required-ros-distributions: humble + - uses: ros-tooling/action-ros-ci@v0.3 + id: action_ros_ci_step + with: + target-ros2-distro: humble + package-name: | + clearpath_diagnostics + clearpath_generator_robot + clearpath_robot + clearpath_sensors + vcs-repo-file-url: clearpath_robot.repos + clearpath_robot_cpr_ci: + name: Humble Clearpath Release runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 @@ -21,6 +39,24 @@ jobs: wget https://packages.clearpathrobotics.com/public.key -O - | sudo apt-key add - sudo sh -c 'echo "deb https://packages.clearpathrobotics.com/stable/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/clearpath-latest.list' sudo apt-get update + - uses: ros-tooling/action-ros-ci@v0.3 + id: action_ros_ci_step + with: + target-ros2-distro: humble + package-name: | + clearpath_diagnostics + clearpath_generator_robot + clearpath_robot + clearpath_sensors + vcs-repo-file-url: clearpath_robot.repos + clearpath_robot_src_ci: + name: Humble Clearpath Source + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: ros-tooling/setup-ros@v0.7 + with: + required-ros-distributions: humble - uses: ros-tooling/action-ros-ci@v0.3 id: action_ros_ci_step with: diff --git a/clearpath_robot.repos b/clearpath_robot.repos new file mode 100644 index 0000000..0c387be --- /dev/null +++ b/clearpath_robot.repos @@ -0,0 +1,5 @@ +repositories: + clearpath_robot: + type: git + url: https://github.com/clearpathrobotics/clearpath_robot.git + version: main diff --git a/dependencies.repos b/dependencies.repos index 0c387be..817db77 100644 --- a/dependencies.repos +++ b/dependencies.repos @@ -3,3 +3,11 @@ repositories: type: git url: https://github.com/clearpathrobotics/clearpath_robot.git version: main + clearpath_config: + type: git + url: https://github.com/clearpathrobotics/clearpath_config.git + version: main + clearpath_common: + type: git + url: https://github.com/clearpathrobotics/clearpath_common.git + version: humble From 9bbc2906a813550049d1da99f8c35dbd5f14cf28 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Thu, 11 Apr 2024 17:40:40 -0400 Subject: [PATCH 12/18] Workspace install paths --- clearpath_generator_robot/test/test_generator_launch.py | 9 +++++---- clearpath_generator_robot/test/test_generator_param.py | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/clearpath_generator_robot/test/test_generator_launch.py b/clearpath_generator_robot/test/test_generator_launch.py index 64068cc..26a0ca0 100644 --- a/clearpath_generator_robot/test/test_generator_launch.py +++ b/clearpath_generator_robot/test/test_generator_launch.py @@ -28,18 +28,19 @@ import os import shutil +from ament_index_python.packages import get_package_share_directory from clearpath_generator_robot.launch.generator import RobotLaunchGenerator -SAMPLE_DIR = '/opt/ros/humble/share/clearpath_config/sample/' - class TestRobotLaunchGenerator: def test_samples(self): errors = [] - for sample in os.listdir(SAMPLE_DIR): + share_dir = get_package_share_directory("clearpath_config") + sample_dir = os.path.join(share_dir, "sample") + for sample in os.listdir(sample_dir): # Create Clearpath Directory - src = os.path.join(SAMPLE_DIR, sample) + src = os.path.join(sample_dir, sample) dst = os.path.join(os.environ['HOME'], '.clearpath', 'robot.yaml') shutil.rmtree(os.path.dirname(dst), ignore_errors=True) os.makedirs(os.path.dirname(dst), exist_ok=True) diff --git a/clearpath_generator_robot/test/test_generator_param.py b/clearpath_generator_robot/test/test_generator_param.py index 689e43b..42c18ca 100644 --- a/clearpath_generator_robot/test/test_generator_param.py +++ b/clearpath_generator_robot/test/test_generator_param.py @@ -28,6 +28,7 @@ import os import shutil +from ament_index_python.packages import get_package_share_directory from clearpath_generator_robot.param.generator import RobotParamGenerator SAMPLE_DIR = '/opt/ros/humble/share/clearpath_config/sample/' @@ -37,9 +38,11 @@ class TestRobotLaunchGenerator: def test_samples(self): errors = [] - for sample in os.listdir(SAMPLE_DIR): + share_dir = get_package_share_directory("clearpath_config") + sample_dir = os.path.join(share_dir, "sample") + for sample in os.listdir(sample_dir): # Create Clearpath Directory - src = os.path.join(SAMPLE_DIR, sample) + src = os.path.join(sample_dir, sample) dst = os.path.join(os.environ['HOME'], '.clearpath', 'robot.yaml') shutil.rmtree(os.path.dirname(dst), ignore_errors=True) os.makedirs(os.path.dirname(dst), exist_ok=True) From 7ba3ab68f10918f8e6ac58bf4785ebe77b7f3895 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Thu, 11 Apr 2024 19:01:03 -0400 Subject: [PATCH 13/18] Lint error in test --- clearpath_generator_robot/test/test_generator_launch.py | 4 ++-- clearpath_generator_robot/test/test_generator_param.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clearpath_generator_robot/test/test_generator_launch.py b/clearpath_generator_robot/test/test_generator_launch.py index 26a0ca0..59629f6 100644 --- a/clearpath_generator_robot/test/test_generator_launch.py +++ b/clearpath_generator_robot/test/test_generator_launch.py @@ -36,8 +36,8 @@ class TestRobotLaunchGenerator: def test_samples(self): errors = [] - share_dir = get_package_share_directory("clearpath_config") - sample_dir = os.path.join(share_dir, "sample") + share_dir = get_package_share_directory('clearpath_config') + sample_dir = os.path.join(share_dir, 'sample') for sample in os.listdir(sample_dir): # Create Clearpath Directory src = os.path.join(sample_dir, sample) diff --git a/clearpath_generator_robot/test/test_generator_param.py b/clearpath_generator_robot/test/test_generator_param.py index 42c18ca..9045351 100644 --- a/clearpath_generator_robot/test/test_generator_param.py +++ b/clearpath_generator_robot/test/test_generator_param.py @@ -38,8 +38,8 @@ class TestRobotLaunchGenerator: def test_samples(self): errors = [] - share_dir = get_package_share_directory("clearpath_config") - sample_dir = os.path.join(share_dir, "sample") + share_dir = get_package_share_directory('clearpath_config') + sample_dir = os.path.join(share_dir, 'sample') for sample in os.listdir(sample_dir): # Create Clearpath Directory src = os.path.join(sample_dir, sample) From b3fab221b1346efddc073afdce8f6e933da34561 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Fri, 12 Apr 2024 16:01:35 -0400 Subject: [PATCH 14/18] Removed clearpath_robot dependencies --- .github/workflows/ci.yml | 15 +++++++++++++-- clearpath_robot.repos | 5 ----- dependencies.repos | 4 ---- 3 files changed, 13 insertions(+), 11 deletions(-) delete mode 100644 clearpath_robot.repos diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df81eec..addaaf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,19 @@ on: - cron: "0 0 * * *" # every day at midnight jobs: + Clearpath_robot_osrf_industrial_ci: + name: Humble OSRF Industrial + strategy: + matrix: + env: + - {ROS_DISTRO: humble, ROS_REPO: testing} + - {ROS_DISTRO: humble, ROS_REPO: main} + fail-fast: false + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: 'ros-industrial/industrial_ci@master' + env: ${{matrix.env}} clearpath_robot_osrf_ci: name: Humble OSRF Release runs-on: ubuntu-22.04 @@ -24,7 +37,6 @@ jobs: clearpath_generator_robot clearpath_robot clearpath_sensors - vcs-repo-file-url: clearpath_robot.repos clearpath_robot_cpr_ci: name: Humble Clearpath Release runs-on: ubuntu-22.04 @@ -48,7 +60,6 @@ jobs: clearpath_generator_robot clearpath_robot clearpath_sensors - vcs-repo-file-url: clearpath_robot.repos clearpath_robot_src_ci: name: Humble Clearpath Source runs-on: ubuntu-22.04 diff --git a/clearpath_robot.repos b/clearpath_robot.repos deleted file mode 100644 index 0c387be..0000000 --- a/clearpath_robot.repos +++ /dev/null @@ -1,5 +0,0 @@ -repositories: - clearpath_robot: - type: git - url: https://github.com/clearpathrobotics/clearpath_robot.git - version: main diff --git a/dependencies.repos b/dependencies.repos index 817db77..c06652b 100644 --- a/dependencies.repos +++ b/dependencies.repos @@ -1,8 +1,4 @@ repositories: - clearpath_robot: - type: git - url: https://github.com/clearpathrobotics/clearpath_robot.git - version: main clearpath_config: type: git url: https://github.com/clearpathrobotics/clearpath_config.git From 1ff27f46d25ad0c81ea19db3867fe3314b7ceca9 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Fri, 12 Apr 2024 16:15:39 -0400 Subject: [PATCH 15/18] ROSDEP_SKIP_KEYS --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index addaaf8..4063c45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ jobs: strategy: matrix: env: - - {ROS_DISTRO: humble, ROS_REPO: testing} - - {ROS_DISTRO: humble, ROS_REPO: main} + - {ROS_DISTRO: humble, ROS_REPO: testing, ROSDEP_SKIP_KEYS: "umx_driver valence_bms_driver"} + - {ROS_DISTRO: humble, ROS_REPO: main, ROSDEP_SKIP_KEYS: "umx_driver valence_bms_driver"} fail-fast: false runs-on: ubuntu-22.04 steps: From 275dc87f0ed1f9440fc77d62546ededbf2c4dd4e Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Fri, 12 Apr 2024 16:17:46 -0400 Subject: [PATCH 16/18] Skip sevcon_traction --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4063c45..c888600 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ jobs: strategy: matrix: env: - - {ROS_DISTRO: humble, ROS_REPO: testing, ROSDEP_SKIP_KEYS: "umx_driver valence_bms_driver"} - - {ROS_DISTRO: humble, ROS_REPO: main, ROSDEP_SKIP_KEYS: "umx_driver valence_bms_driver"} + - {ROS_DISTRO: humble, ROS_REPO: testing, ROSDEP_SKIP_KEYS: "sevcon_traction umx_driver valence_bms_driver"} + - {ROS_DISTRO: humble, ROS_REPO: main, ROSDEP_SKIP_KEYS: "sevcon_traction umx_driver valence_bms_driver"} fail-fast: false runs-on: ubuntu-22.04 steps: From 98fc933dba1496c7ea028322ecb49c1da4db70e4 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Fri, 12 Apr 2024 16:21:49 -0400 Subject: [PATCH 17/18] Skip micro-ros-agent --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c888600..5ac2fc1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ jobs: strategy: matrix: env: - - {ROS_DISTRO: humble, ROS_REPO: testing, ROSDEP_SKIP_KEYS: "sevcon_traction umx_driver valence_bms_driver"} - - {ROS_DISTRO: humble, ROS_REPO: main, ROSDEP_SKIP_KEYS: "sevcon_traction umx_driver valence_bms_driver"} + - {ROS_DISTRO: humble, ROS_REPO: testing, ROSDEP_SKIP_KEYS: "micro_ros_agent sevcon_traction umx_driver valence_bms_driver"} + - {ROS_DISTRO: humble, ROS_REPO: main, ROSDEP_SKIP_KEYS: "micro_ros_agent sevcon_traction umx_driver valence_bms_driver"} fail-fast: false runs-on: ubuntu-22.04 steps: From 8449ffa7ca7a5a9e1f1ae62ca986dc8f4ee1ba8e Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Fri, 12 Apr 2024 16:28:21 -0400 Subject: [PATCH 18/18] Removed ROS ci --- .github/workflows/ci.yml | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ac2fc1..8aae003 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,36 +7,19 @@ on: - cron: "0 0 * * *" # every day at midnight jobs: - Clearpath_robot_osrf_industrial_ci: + clearpath_robot_osrf_industrial_ci: name: Humble OSRF Industrial strategy: matrix: env: - - {ROS_DISTRO: humble, ROS_REPO: testing, ROSDEP_SKIP_KEYS: "micro_ros_agent sevcon_traction umx_driver valence_bms_driver"} - - {ROS_DISTRO: humble, ROS_REPO: main, ROSDEP_SKIP_KEYS: "micro_ros_agent sevcon_traction umx_driver valence_bms_driver"} + - {ROS_REPO: testing, ROS_DISTRO: humble, ROSDEP_SKIP_KEYS: "micro_ros_agent sevcon_traction umx_driver valence_bms_driver"} + - {ROS_REPO: main, ROS_DISTRO: humble, ROSDEP_SKIP_KEYS: "micro_ros_agent sevcon_traction umx_driver valence_bms_driver"} fail-fast: false runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: 'ros-industrial/industrial_ci@master' env: ${{matrix.env}} - clearpath_robot_osrf_ci: - name: Humble OSRF Release - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - uses: ros-tooling/setup-ros@v0.7 - with: - required-ros-distributions: humble - - uses: ros-tooling/action-ros-ci@v0.3 - id: action_ros_ci_step - with: - target-ros2-distro: humble - package-name: | - clearpath_diagnostics - clearpath_generator_robot - clearpath_robot - clearpath_sensors clearpath_robot_cpr_ci: name: Humble Clearpath Release runs-on: ubuntu-22.04