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

Jazzy 2.0 RC #92

Draft
wants to merge 23 commits into
base: jazzy
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2905163
Initial can_bridges add
luis-camero Aug 27, 2024
d9ff6ab
rx and tx topics for can bridge
luis-camero Aug 27, 2024
932968d
Add header
luis-camero Oct 9, 2024
5c73f39
Removed line at EOF
luis-camero Oct 10, 2024
8e1f908
Merge pull request #81 from clearpathrobotics/lcamero/wip-jazzy
luis-camero Oct 10, 2024
6c39288
Add the ability to flag previously-supported accessories & platforms …
civerachb-cpr Nov 6, 2024
88ee93d
Changes.
tonybaltovski Oct 4, 2024
debd4e2
0.3.4
tonybaltovski Oct 4, 2024
e10a7ae
Add a sample for each sensor
luis-camero Oct 8, 2024
0fd6711
Add ur_arm
luis-camero Nov 14, 2024
c66f884
Add support for Axis cameras (#90)
civerachb-cpr Nov 19, 2024
3fb729d
Add default vcan ROS interfaces based on platform
luis-camero Nov 22, 2024
03961b4
Add the ability to flag previously-supported accessories & platforms …
civerachb-cpr Nov 6, 2024
e899332
Add A300 platform entry
luis-camero Nov 25, 2024
f6625d3
Add a300 platform attachments
luis-camero Nov 25, 2024
48808bd
Add a300 platform battery
luis-camero Nov 25, 2024
ef74611
Add a300 can interfaces
luis-camero Nov 25, 2024
a440138
Add a300 platform empty ros parameters
luis-camero Nov 25, 2024
f4bb5b3
Add a300 to attachment mux
luis-camero Nov 25, 2024
0c90859
Add a300 extra ros parameters
luis-camero Nov 25, 2024
f916921
Fix all linting errors
luis-camero Nov 25, 2024
8429fba
A300 battery comment to LiFEPO4
luis-camero Nov 25, 2024
858d4cc
Merge pull request #94 from clearpathrobotics/feature/a300
roni-kreinin Nov 27, 2024
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
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ assignees: clearpathrobotics/clearpath-platform-team
---

**Please provide the following information:**
- OS: (e.g. Ubuntu 22.04)
- ROS 2 Distro: (e.g. Humble)
- OS: (e.g. Ubuntu 24.04)
- ROS 2 Distro: (e.g. Jazzy)
- Built from source or installed:
- Package version: (if from repository, give version from `sudo dpkg -s ros-$ROS_VERSION-clearpath-common`, if from source, give commit hash)
- Real hardware or simulation:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ on:

jobs:
build_and_test:
name: humble
name: jazzy
strategy:
matrix:
env:
- {ROS_DISTRO: humble, ROS_REPO: testing}
- {ROS_DISTRO: humble, ROS_REPO: main}
- {ROS_DISTRO: jazzy, ROS_REPO: testing}
- {ROS_DISTRO: jazzy, ROS_REPO: main}
fail-fast: false
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: 'ros-industrial/industrial_ci@master'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ on:
jobs:
build:

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changelog for package clearpath_config
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.3.4 (2024-10-04)
------------------
* Add OAKD
* Add phidgets spatial to config
* Contributors: Luis Camero

0.3.3 (2024-09-29)
------------------
* Allow all parameters to be modified
Expand Down
26 changes: 12 additions & 14 deletions clearpath_config/clearpath_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@
# POSSIBILITY OF SUCH DAMAGE.
from clearpath_config.common.types.config import BaseConfig
from clearpath_config.common.utils.yaml import read_yaml, write_yaml
from clearpath_config.system.system import SystemConfig
from clearpath_config.platform.platform import PlatformConfig
from clearpath_config.links.links import LinksConfig
from clearpath_config.manipulators.manipulators import ManipulatorConfig
from clearpath_config.mounts.mounts import MountsConfig
from clearpath_config.platform.platform import PlatformConfig
from clearpath_config.sensors.sensors import SensorConfig
from clearpath_config.system.system import SystemConfig


# ClearpathConfig:
# - top level configurator
# - contains
class ClearpathConfig(BaseConfig):

VERSION = "version"
SERIAL_NUMBER = "serial_number"
SYSTEM = "system"
PLATFORM = "platform"
LINKS = "links"
MANIPULATORS = "manipulators"
MOUNTS = "mounts"
SENSORS = "sensors"
VERSION = 'version'
SERIAL_NUMBER = 'serial_number'
SYSTEM = 'system'
PLATFORM = 'platform'
LINKS = 'links'
MANIPULATORS = 'manipulators'
MOUNTS = 'mounts'
SENSORS = 'sensors'

TEMPLATE = {
SERIAL_NUMBER: SERIAL_NUMBER,
Expand All @@ -63,7 +63,7 @@ class ClearpathConfig(BaseConfig):
KEYS = TEMPLATE

DEFAULTS = {
SERIAL_NUMBER: "generic",
SERIAL_NUMBER: 'generic',
VERSION: 0,
SYSTEM: SystemConfig.DEFAULTS,
PLATFORM: PlatformConfig.DEFAULTS,
Expand Down Expand Up @@ -136,9 +136,7 @@ def version(self) -> int:

@version.setter
def version(self, v: int) -> None:
assert isinstance(v, int), (
"version must be of type 'int'"
)
assert isinstance(v, int), 'version must be of type "int"'
self._version = v
# Add propagators here

Expand Down
31 changes: 31 additions & 0 deletions clearpath_config/common/ros.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Software License Agreement (BSD)
#
# @author Chris Iverach-Brereton <[email protected]>
# @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.

import os

ROS_DISTRO = os.environ.get('ROS_DISTRO', 'jazzy')
78 changes: 60 additions & 18 deletions clearpath_config/common/types/accessory.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
# POSSIBILITY OF SUCH DAMAGE.
from typing import List

from clearpath_config.common.types.exception import UnsupportedAccessoryException


class Accessory():
# Defaults
PARENT = "default_mount"
PARENT = 'default_mount'
XYZ = [0.0, 0.0, 0.0]
RPY = [0.0, 0.0, 0.0]

Expand All @@ -41,10 +43,15 @@ def __init__(
xyz: List[float] = XYZ,
rpy: List[float] = RPY
) -> None:
self.name = str()
self.parent = str()
self.xyz = list()
self.rpy = list()

self.assert_is_supported()
if self.is_deprecated:
print(f'{type(self)} is deprecated')

self.name = ''
self.parent = ''
self.xyz = []
self.rpy = []
self.set_name(name)
self.set_parent(parent)
self.set_xyz(xyz)
Expand Down Expand Up @@ -88,7 +95,7 @@ def get_xyz(self) -> List[float]:
def set_xyz(self, xyz: List[float]) -> None:
self.assert_valid_triplet(
xyz,
"XYZ must be a list of exactly three float values"
'XYZ must be a list of exactly three float values'
)
self.xyz = xyz

Expand All @@ -98,33 +105,68 @@ def get_rpy(self) -> List[float]:
def set_rpy(self, rpy: List[float]) -> None:
self.assert_valid_triplet(
rpy,
"RPY must be a list of exactly three float values"
'RPY must be a list of exactly three float values'
)
self.rpy = rpy

@staticmethod
def assert_valid_link(link: str) -> None:
# Link name must be a string
assert isinstance(link, str), "Link name '%s' must be string" % link
assert isinstance(link, str), f'Link name "{link}" must be string'
# Link name must not be empty
assert link, "Link name '%s' must not be empty" % link
assert link, f'Link name "{link}" must not be empty'
# Link name must not have spaces
assert " " not in link, "Link name '%s' must no have spaces" % link
assert ' ' not in link, f'Link name "{link}" must no have spaces'
# Link name must not start with a digit
assert not link[0].isdigit(), (
"Link name '%s' must not start with a digit" % link
)
assert not link[0].isdigit(), f'Link name "{link} must not start with a digit'

@staticmethod
def assert_valid_triplet(tri: List[float], msg: str = None) -> None:
if msg is None:
msg = "Triplet must be a list of three float values"
msg = 'Triplet must be a list of three float values'
# Triplet must be a list
assert isinstance(tri, list), msg
# Triplet must have a length of 3
assert len(tri) == 3, msg
# Triplet must be all floats
assert all([isinstance(i, float) for i in tri])
assert all([isinstance(i, float) for i in tri]) # noqa:C419

@staticmethod
def assert_is_supported():
"""
Override this method to temporarily disable accessories that are not currently supported.

When disabling an accessory, raise a
clearpath_config.common.types.exception.UnsupportedAccessoryException
with a suitable mesage (e.g. 'SpamEggs driver is not yet released for ROS 2 Jazzy')

@return None

@exception Raises a clearpath_config.common.types.exception.UnsupportedAccessoryException
if the accessory is not supported
"""
pass

@property
def is_suppported(self):
try:
self.assert_is_supported()
return True
except UnsupportedAccessoryException:
return False

@property
def is_deprecated(self):
"""
Override this method to indicate that this accessory has been deprecated.

Deprecated accessories may be removed completely in the future. See:
- is_supported
- assert_is_supported

When flagging an accessory for deprecation, simply override it to return True
"""
return False


class IndexedAccessory(Accessory):
Expand Down Expand Up @@ -155,12 +197,12 @@ def __init__(

@classmethod
def get_name_from_idx(idx):
return "accessory_%s" % idx
return 'accessory_%s' % idx

def get_idx(self) -> str:
return self.idx

def set_idx(self, idx: int) -> None:
assert isinstance(idx, int), "Index must be an integer"
assert idx >= 0, "Index must be a positive integer"
assert isinstance(idx, int), 'Index must be an integer'
assert idx >= 0, 'Index must be a positive integer'
self.name = self.get_name_from_idx(idx)
25 changes: 10 additions & 15 deletions clearpath_config/common/types/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,24 @@
# 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_config.common.types.serial_number import SerialNumber
from typing import Any

from clearpath_config.common.types.namespace import Namespace
from clearpath_config.common.types.serial_number import SerialNumber
from clearpath_config.common.utils.dictionary import (
flatten_dict,
get_from_dict,
is_in_dict,
set_in_dict,
unflatten_dict
)
from typing import Any


class BaseConfig:
_SERIAL_NUMBER = SerialNumber("generic")
_SERIAL_NUMBER = SerialNumber('generic')
_NAMESPACE = Namespace()
_VERSION = 0
DLIM = "."
DLIM = '.'

def __init__(
self,
Expand Down Expand Up @@ -71,14 +72,12 @@ def template(self) -> dict:

@template.setter
def template(self, value: dict) -> None:
assert isinstance(value, dict), (
"template must of type 'dict'"
)
assert isinstance(value, dict), 'template must be of type "dict"'
# Check that template has all properties
flat_template = flatten_dict(d=value, dlim=BaseConfig.DLIM)
for _, val in flat_template.items():
assert isinstance(val, property), (
"All entries in template must be properties"
'All entries in template must be properties'
)
self._template = value

Expand All @@ -94,13 +93,11 @@ def config(self) -> dict:
def config(self, value: dict) -> None:
if value is None:
return
assert isinstance(value, dict), (
"config must be of type 'dict'"
)
assert isinstance(value, dict), 'config must be of type "dict"'
if self._parent_key is not None and self._parent_key not in value:
value = {self._parent_key: value}
value = unflatten_dict(value)
for map, prop in flatten_dict(
for map, prop in flatten_dict( # noqa:A001
d=self.template, dlim=BaseConfig.DLIM).items():
keys = map.split(BaseConfig.DLIM)
if is_in_dict(value, keys):
Expand Down Expand Up @@ -143,6 +140,4 @@ def set_namespace(cls, namespace: str | Namespace) -> None:
elif isinstance(namespace, str):
BaseConfig._NAMESPACE = Namespace(namespace)
else:
assert isinstance(namespace, str) or isinstance(namespace, Namespace), (
"Namespace must be of type 'str' or 'Namespace'"
)
assert isinstance(namespace, str) or isinstance(namespace, Namespace), 'Namespace must be of type "str" or "Namespace"' # noqa:E501
10 changes: 5 additions & 5 deletions clearpath_config/common/types/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
# POSSIBILITY OF SUCH DAMAGE.

class Discovery:
SIMPLE = "simple"
SERVER = "server"
SIMPLE = 'simple'
SERVER = 'server'

# All supported discovery modes, currently only set up for FastDDS
ALL_SUPPORTED = [SIMPLE, SERVER]
Expand Down Expand Up @@ -60,7 +60,7 @@ def is_valid(cls, mode: str) -> bool:

@classmethod
def assert_valid(cls, mode: str) -> None:
assert cls.is_valid(mode), ("\n".join[
f"Discovery mode '{mode}' not supported."
f"Discovery mode must be one of: '{cls.ALL_SUPPORTED}'"
assert cls.is_valid(mode), ('\n'.join[
f'Discovery mode "{mode}" not supported.'
f'Discovery mode must be one of: "{cls.ALL_SUPPORTED}"'
])
Loading