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

Fix hard-coded humble packages #117

Merged
merged 1 commit into from
Jan 13, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ from rclpy.qos import qos_profile_sensor_data
from sensor_msgs.msg import BatteryState, Image, Imu, LaserScan, MagneticField, NavSatFix, PointCloud2

from clearpath_generator_common.common import BaseGenerator
from clearpath_generator_common.ros import ROS_DISTRO
from clearpath_config.common.utils.yaml import read_yaml
from clearpath_config.clearpath_config import ClearpathConfig
from clearpath_config.sensors.types.sensor import BaseSensor
Expand Down Expand Up @@ -100,12 +101,12 @@ class ClearpathDiagnosticUpdater(Node):
# Check current firmware version
cache = Cache()
try:
pkg = cache['ros-humble-clearpath-firmware']
pkg = cache[f'ros-{ROS_DISTRO}-clearpath-firmware']
versions = pkg.versions
newest: Version = versions[0]
self.newest_firmware_version = newest.version.split('-')[0]
except KeyError:
self.get_logger().warn('ros-humble-clearpath-firmware package not found')
self.get_logger().warn(f'ros-{ROS_DISTRO}-clearpath-firmware package not found')
self.newest_firmware_version = 'Not found'

self.firmware_version = '0.0.0'
Expand All @@ -124,13 +125,13 @@ class ClearpathDiagnosticUpdater(Node):

def check_firmware_version(self, stat: DiagnosticStatusWrapper):
if self.newest_firmware_version == 'Not found':
stat.summary(DiagnosticStatus.ERROR, 'ros-humble-clearpath-firmware package not found')
stat.summary(DiagnosticStatus.ERROR, f'ros-{ROS_DISTRO}-clearpath-firmware package not found')
elif self.firmware_version == self.newest_firmware_version:
stat.summary(DiagnosticStatus.OK, f'Firmware is up to date (v{self.firmware_version})')
elif self.firmware_version < self.newest_firmware_version:
stat.summary(DiagnosticStatus.WARN, f'New firmware available. (v{self.firmware_version}) -> (v{self.newest_firmware_version})')
else:
stat.summary(DiagnosticStatus.WARN, 'ros-humble-clearpath-firmware package is outdated.')
stat.summary(DiagnosticStatus.WARN, f'ros-{ROS_DISTRO}-clearpath-firmware package is outdated.')
return stat

def get_headerless_topic_diagnostic(self,
Expand Down
Loading