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

Continuous Integration Testing #51

Merged
merged 18 commits into from
Apr 13, 2024
Merged
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
49 changes: 44 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,57 @@ on:
- cron: "0 0 * * *" # every day at midnight

jobs:
clearpath_robot_ci:
name: Humble
clearpath_robot_osrf_industrial_ci:
name: Humble OSRF Industrial
strategy:
matrix:
env:
- {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-tooling/[email protected]
- uses: 'ros-industrial/industrial_ci@master'
env: ${{matrix.env}}
clearpath_robot_cpr_ci:
name: Humble Clearpath Release
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: humble
- name: clearpath-package-server
run: |
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/[email protected]
id: action_ros_ci_step
with:
target-ros2-distro: humble

package-name: clearpath_robot
package-name: |
clearpath_diagnostics
clearpath_generator_robot
clearpath_robot
clearpath_sensors
clearpath_robot_src_ci:
name: Humble Clearpath Source
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: humble
- uses: ros-tooling/[email protected]
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: dependencies.repos
8 changes: 4 additions & 4 deletions clearpath_diagnostics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,18 @@
# 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. """
"""Base Battery class."""

"""Battery configuration. Represents number of battery cells in series and parallel."""
CONFIGURATIONS = {
Expand Down Expand Up @@ -102,7 +99,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

Expand Down Expand Up @@ -189,6 +185,7 @@ def update_cells(self):

class LiION(BaseBattery):
"""Base Lithium ION battery."""

LUT = []

def __init__(
Expand Down
40 changes: 20 additions & 20 deletions clearpath_diagnostics/launch/diagnostics.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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)

Expand All @@ -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]
),
Expand Down
14 changes: 14 additions & 0 deletions clearpath_generator_robot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -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.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

import os


class RobotLaunchGenerator(LaunchGenerator):

def __init__(self, setup_path: str = '/etc/clearpath/') -> None:
super().__init__(setup_path)

Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -153,18 +152,18 @@ 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'

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),
Expand Down
Loading
Loading