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
126 stars 32 forks source link

Example of ethercat_generic_plugins/EcCiA402Drive #54

Closed jaronski closed 1 year ago

jaronski commented 1 year ago

Hello, would it be possible to show an example of how to integrate the EcCiA402Drive into a xacro and the corresponding config.yaml? i have a CiA402 Drive that i would like to use with the ethercat_driver_ros2 but i am having trouble with the configuration. I adjusted the Configuration File as shown in the MaxonEpos3 example to the appropriate values to match my drive (rpdo, tpdo). I created a urdf.xacro with the ros2_control tag where the ethercat_driver is started and configured 1 joint with command interface position and velocity as ec_module i choose the plugin ethercat_generic_plugins/EcCiA402Drive put the alias and position on the ethercat bus mode_of_operation to 8 or 9 depending on what i want to test out and the param slave_config i put the config.yaml i adjusted.

how can i claim the and to what controller? Can you show this for the EPOS3? i am able to start the drive and move it to a position sometimes and then i restart and when i launch everything again sometimes the drive doesn't get into Operation Enabled and i don't understand why.

Any help or pointers in the right direction would be much appreciated best regards jaronski

mcbed commented 1 year ago

Hi @jaronski, If your drive is in fault it will not be able to switch to OE mode and the fault needs to be reset. This can be done in 2 ways:

  1. use the control word to do fault reset using SDO by running ethercat -m 0 -p 0 download -t uint16 0x6040 0x00 128 to set the fault reset bit to 1.
  2. use the command interface reset_fault and interface it with a controller. It does fault reset on rising edge signal on the interface (0 -> 1). There is a controller that can do this on this branch. You configure this controller like this:

    controller_manager:
     ros__parameters:
       update_rate: 100  # Hz
    
       gpio_command_controller:
         type: gpio_controllers/GpioCommandController
    
    gpio_command_controller:
     ros__parameters:
       gpios:
         - joint_1
       command_interfaces:
          joint_1:
           - reset_fault

    Note: you need to add to your urdf.

jaronski commented 1 year ago

Hi @mcbed thanks for your response. I will check that out first thing on Monday 😉

best regards and a great weekend

AlessioMosca commented 1 year ago

Hi @mcbed, may i ask why he needs to add instead of ?

Best Regards Alessio

mcbed commented 1 year ago

Hi @AlessioMosca, You need both for the controller to configure. It is a incomplete feature but I did not have the time to fix it yet.

mcbed commented 1 year ago

Hi @jaronski, There is now the possibility to reset fault using a ros service, check out PR #61 if interested