Skip to content

Commit

Permalink
[Backport] Socket CAN Bridges (#93) (#98)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
luis-camero and roni-kreinin authored Nov 20, 2024
1 parent 1f25da6 commit 1be95f6
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,28 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None:
namespace=self.namespace,
)

# ROS2 socketcan bridges
ros2_socketcan_package = Package('ros2_socketcan')
self.can_bridges = []
for can_bridge in self.clearpath_config.platform.can_bridges.get_all():
self.can_bridges.append(LaunchFile(
'socket_can_receiver',
package=ros2_socketcan_package,
args=[
('interface', can_bridge.interface),
('from_can_bus_topic', f'{self.namespace}/{can_bridge.topic_rx}'),
]
))

self.can_bridges.append(LaunchFile(
'socket_can_sender',
package=ros2_socketcan_package,
args=[
('interface', can_bridge.interface),
('to_can_bus_topic', f'{self.namespace}/{can_bridge.topic_tx}'),
]
))

# Components required for each platform
common_platform_components = [
self.wireless_watcher_node,
Expand All @@ -211,6 +233,9 @@ def __init__(self, setup_path: str = '/etc/clearpath/') -> None:
self.battery_state_control
]

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

self.platform_components = {
Platform.J100: common_platform_components + [
self.imu_0_filter_node,
Expand Down

0 comments on commit 1be95f6

Please sign in to comment.