Skip to content

Commit

Permalink
Socket CAN Bridges (#93)
Browse files Browse the repository at this point in the history
* Generate can bridges

* Generate script source robot workspace

* Remove extra line

---------

Co-authored-by: Roni Kreinin <[email protected]>
  • Loading branch information
luis-camero and roni-kreinin authored Oct 10, 2024
1 parent 6b86389 commit 02e308d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,39 @@ 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,
self.diagnostics_launch,
self.battery_state_estimator,
self.battery_state_control
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
3 changes: 2 additions & 1 deletion clearpath_robot/scripts/generate
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

source /opt/ros/humble/setup.bash
source /opt/ros/jazzy/setup.bash
source /home/administrator/colcon_ws/install/setup.bash

# Generate and source setup.bash
ros2 run clearpath_generator_common generate_bash
Expand Down

0 comments on commit 02e308d

Please sign in to comment.