diff --git a/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py b/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py
index 92d15f7..f0d80c7 100644
--- a/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py
+++ b/clearpath_generator_robot/clearpath_generator_robot/launch/generator.py
@@ -32,6 +32,7 @@
# modification, is not permitted without the express permission
# of Clearpath Robotics.
+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
@@ -149,6 +150,34 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None:
arguments=['-s', setup_path]
)
+ # Valence BMS
+ self.bms_launch_file = None
+ if (self.clearpath_config.platform.battery.model in
+ [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']
+
+ bms_launch_args = [
+ ('namespace', self.namespace),
+ ('can_device', can_dev),
+ ('bms_id', bms_id),
+ ]
+
+ self.bms_launch_file = LaunchFile(
+ 'bms',
+ package=Package('valence_bms_driver'),
+ args=bms_launch_args
+ )
+
# Lighting
self.lighting_node = LaunchFile.Node(
package='clearpath_platform',
@@ -247,4 +276,7 @@ def generate_platform(self) -> None:
for component in self.platform_components[self.platform_model]:
platform_service_launch_writer.add(component)
+ if self.bms_launch_file:
+ platform_service_launch_writer.add(self.bms_launch_file)
+
platform_service_launch_writer.generate_file()
diff --git a/clearpath_generator_robot/package.xml b/clearpath_generator_robot/package.xml
index d223108..8e8b2ca 100644
--- a/clearpath_generator_robot/package.xml
+++ b/clearpath_generator_robot/package.xml
@@ -17,6 +17,7 @@
imu_filter_madgwick
micro_ros_agent
sevcon_traction
+ valence_bms_driver
wireless_watcher
ament_lint_auto