|
44 | 44 | ) |
45 | 45 | from clearpath_config.manipulators.types.grippers import FrankaGripper |
46 | 46 | from clearpath_config.platform.battery import BatteryConfig |
| 47 | +from clearpath_config.platform.wireless import PeplinkRouter |
47 | 48 | from clearpath_generator_common.common import LaunchFile, Package |
48 | 49 | from clearpath_generator_common.launch.generator import LaunchGenerator |
49 | 50 | from clearpath_generator_common.launch.writer import LaunchWriter |
@@ -142,6 +143,56 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None: |
142 | 143 | remappings=[('/diagnostics', 'diagnostics'),], |
143 | 144 | ) |
144 | 145 |
|
| 146 | + # Onboard router & base station |
| 147 | + if isinstance(self.clearpath_config.platform.wireless.router, PeplinkRouter): |
| 148 | + self.wireless_router_node = LaunchFile.Node( |
| 149 | + package='peplink_router_driver', |
| 150 | + executable='peplink_router_node', |
| 151 | + name='router_node', |
| 152 | + namespace=f'{self.namespace}/network/router', |
| 153 | + parameters=[ |
| 154 | + { |
| 155 | + 'ip_address': |
| 156 | + self.clearpath_config.platform.wireless.router.ip_address, |
| 157 | + 'username': |
| 158 | + self.clearpath_config.platform.wireless.router.username, |
| 159 | + 'password': |
| 160 | + self.clearpath_config.platform.wireless.router.password, |
| 161 | + 'enable_gps': |
| 162 | + self.clearpath_config.platform.wireless.router.enable_gps, |
| 163 | + 'publish_passwords': |
| 164 | + self.clearpath_config.platform.wireless.router.publish_passwords, |
| 165 | + } |
| 166 | + ], |
| 167 | + remappings=[('/diagnostics', 'diagnostics'),], |
| 168 | + ) |
| 169 | + else: |
| 170 | + self.wireless_router_node = None |
| 171 | + if isinstance(self.clearpath_config.platform.wireless.base_station, PeplinkRouter): |
| 172 | + self.base_station_node = LaunchFile.Node( |
| 173 | + package='peplink_router_driver', |
| 174 | + executable='peplink_router_node', |
| 175 | + name='base_station_node', |
| 176 | + namespace=f'{self.namespace}/network/base_station', |
| 177 | + parameters=[ |
| 178 | + { |
| 179 | + 'ip_address': |
| 180 | + self.clearpath_config.platform.wireless.base_station.ip_address, |
| 181 | + 'username': |
| 182 | + self.clearpath_config.platform.wireless.base_station.username, |
| 183 | + 'password': |
| 184 | + self.clearpath_config.platform.wireless.base_station.password, |
| 185 | + 'enable_gps': |
| 186 | + self.clearpath_config.platform.wireless.base_station.enable_gps, |
| 187 | + 'publish_passwords': |
| 188 | + self.clearpath_config.platform.wireless.base_station.publish_passwords, |
| 189 | + } |
| 190 | + ], |
| 191 | + remappings=[('/diagnostics', 'diagnostics'),], |
| 192 | + ) |
| 193 | + else: |
| 194 | + self.base_station_node = None |
| 195 | + |
145 | 196 | # Diagnostics launch args |
146 | 197 | self.diag_updater_params = LaunchFile.LaunchArg( |
147 | 198 | 'diagnostic_updater_params', |
@@ -395,8 +446,20 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None: |
395 | 446 | if self.bms_launch_file is None and self.bms_node is None: |
396 | 447 | common_platform_components.append(self.battery_state_estimator) |
397 | 448 |
|
398 | | - if self.clearpath_config.platform.enable_wireless_watcher: |
| 449 | + if self.clearpath_config.platform.wireless.enable_wireless_watcher: |
399 | 450 | common_platform_components.append(self.wireless_watcher_node) |
| 451 | + if ( |
| 452 | + self.wireless_router_node is not None |
| 453 | + and self.clearpath_config.platform.wireless.router is not None |
| 454 | + and self.clearpath_config.platform.wireless.router.launch_enabled |
| 455 | + ): |
| 456 | + common_platform_components.append(self.wireless_router_node) |
| 457 | + if ( |
| 458 | + self.base_station_node is not None |
| 459 | + and self.clearpath_config.platform.wireless.base_station is not None |
| 460 | + and self.clearpath_config.platform.wireless.base_station.launch_enabled |
| 461 | + ): |
| 462 | + common_platform_components.append(self.base_station_node) |
400 | 463 |
|
401 | 464 | if len(self.can_bridges) > 0: |
402 | 465 | common_platform_components.extend(self.can_bridges) |
|
0 commit comments