Skip to content

Commit

Permalink
Fix hard-coded humble packages
Browse files Browse the repository at this point in the history
  • Loading branch information
civerachb-cpr committed Jan 13, 2025
1 parent 49db219 commit b87f179
Showing 1 changed file with 5 additions and 4 deletions.
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

0 comments on commit b87f179

Please sign in to comment.