ICube-Robotics / ethercat_driver_ros2

Hardware Interface for EtherCAT module integration with ros2_control
https://icube-robotics.github.io/ethercat_driver_ros2/
Apache License 2.0
125 stars 32 forks source link

Launch EtercatDriver on inactive state at initial state #83

Closed MattiaDeiRossi closed 8 months ago

MattiaDeiRossi commented 8 months ago

Hi all,

I would to launch ros2_control_node having my hardware component on inactive state as first state. I read the documentation at https://control.ros.org/master/doc/ros2_control/controller_manager/doc/userdoc.html that works like

hardware_components_initial_state:
  unconfigured:
    - "arm1"
    - "arm2"
  inactive:
    - "base3"

and my ros2_control description looks like:

<?xml version="1.0" encoding="utf-8"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
  <xacro:macro name="awtube_ros2_control"
    params="use_fake_hardware:=^|true robot_id:=^|awtube brand:=^|synapticon mode_of_op:=^|8">

    <ros2_control name="AwTubeSystem" type="system">
      <hardware>
        <xacro:if value="${use_fake_hardware}">
          <plugin>fake_components/GenericSystem</plugin>
        </xacro:if>
        <xacro:unless value="${use_fake_hardware}">
          <plugin>ethercat_driver/EthercatDriver</plugin>
          <param name="master_id">0</param>
          <param name="control_frequency">1000</param>
        </xacro:unless>
      </hardware>
      .
      .
      .
    </ros2_control>
  </xacro:macro>
</robot>

When writing in my ros2_controller.yam the following code, controllers go immediately in the activate state, and do not stop in the inactive.

controller_manager:
  ros__parameters:
    update_rate: 1000
    hardware_components_initial_state:
      inactive:
      - AwTubeSystem

Have your got any idea to add this feature?

Thanks

MattiaDeiRossi commented 8 months ago

Solved in #1128