Skip to content

Commit 17977bf

Browse files
Generate peplink launches (#275)
* Use the new platform.wireless, add peplink nodes for the onboard router + base station hardware. Move the wireless_watcher flag into platform.wireless * Add peplink router dependency * Remap the diagnostics topic for the peplink nodes
1 parent e4ab9fa commit 17977bf

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

clearpath_generator_robot/clearpath_generator_robot/launch/generator.py

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
)
4545
from clearpath_config.manipulators.types.grippers import FrankaGripper
4646
from clearpath_config.platform.battery import BatteryConfig
47+
from clearpath_config.platform.wireless import PeplinkRouter
4748
from clearpath_generator_common.common import LaunchFile, Package
4849
from clearpath_generator_common.launch.generator import LaunchGenerator
4950
from clearpath_generator_common.launch.writer import LaunchWriter
@@ -142,6 +143,56 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None:
142143
remappings=[('/diagnostics', 'diagnostics'),],
143144
)
144145

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+
145196
# Diagnostics launch args
146197
self.diag_updater_params = LaunchFile.LaunchArg(
147198
'diagnostic_updater_params',
@@ -395,8 +446,20 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None:
395446
if self.bms_launch_file is None and self.bms_node is None:
396447
common_platform_components.append(self.battery_state_estimator)
397448

398-
if self.clearpath_config.platform.enable_wireless_watcher:
449+
if self.clearpath_config.platform.wireless.enable_wireless_watcher:
399450
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)
400463

401464
if len(self.can_bridges) > 0:
402465
common_platform_components.extend(self.can_bridges)

clearpath_generator_robot/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<exec_depend>imu_filter_madgwick</exec_depend>
2121
<exec_depend>canopen_inventus_bringup</exec_depend>
2222
<exec_depend>micro_ros_agent</exec_depend>
23+
<exec_depend>peplink_router_driver</exec_depend>
2324
<exec_depend>python3-apt</exec_depend>
2425
<exec_depend>sevcon_traction</exec_depend>
2526
<exec_depend>valence_bms_driver</exec_depend>

0 commit comments

Comments
 (0)