Skip to content

Commit 1be95f6

Browse files
[Backport] Socket CAN Bridges (#93) (#98)
* Socket CAN Bridges (#93) * Generate can bridges * Generate script source robot workspace * Remove extra line --------- Co-authored-by: Roni Kreinin <[email protected]> * Revert source path in generate script * Remove trailing comma --------- Co-authored-by: Roni Kreinin <[email protected]>
1 parent 1f25da6 commit 1be95f6

File tree

1 file changed

+25
-0
lines changed
  • clearpath_generator_robot/clearpath_generator_robot/launch

1 file changed

+25
-0
lines changed

clearpath_generator_robot/clearpath_generator_robot/launch/generator.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,28 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None:
203203
namespace=self.namespace,
204204
)
205205

206+
# ROS2 socketcan bridges
207+
ros2_socketcan_package = Package('ros2_socketcan')
208+
self.can_bridges = []
209+
for can_bridge in self.clearpath_config.platform.can_bridges.get_all():
210+
self.can_bridges.append(LaunchFile(
211+
'socket_can_receiver',
212+
package=ros2_socketcan_package,
213+
args=[
214+
('interface', can_bridge.interface),
215+
('from_can_bus_topic', f'{self.namespace}/{can_bridge.topic_rx}'),
216+
]
217+
))
218+
219+
self.can_bridges.append(LaunchFile(
220+
'socket_can_sender',
221+
package=ros2_socketcan_package,
222+
args=[
223+
('interface', can_bridge.interface),
224+
('to_can_bus_topic', f'{self.namespace}/{can_bridge.topic_tx}'),
225+
]
226+
))
227+
206228
# Components required for each platform
207229
common_platform_components = [
208230
self.wireless_watcher_node,
@@ -211,6 +233,9 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None:
211233
self.battery_state_control
212234
]
213235

236+
if len(self.can_bridges) > 0:
237+
common_platform_components.extend(self.can_bridges)
238+
214239
self.platform_components = {
215240
Platform.J100: common_platform_components + [
216241
self.imu_0_filter_node,

0 commit comments

Comments
 (0)