rokokoo / hal_core

Hardware abstract layer "HAL" for Raspberry PI
GNU General Public License v2.0
0 stars 1 forks source link

Integrate an easy way to configure our hardware and ROS nodes #1

Open jjrbfi opened 2 years ago

jjrbfi commented 2 years ago

The principal idea is to have a YAML file with our configuration:

  1. Actual Beckhoff EtherCAT hardware configuration.
  2. Remap component Pins as for example: lcec.0.2.din-6-not to R_switch.

I will attach images with our actual EtherCAT configuration in our iICM robot:

image

jjrbfi commented 2 years ago

This is an example that how will look the YAML file with the config we have on mind.

ETHERCAT:
  MASTERIDX:  '0'
  APPTIMEPERIOD:  '1000000'
  REFCLOCKSYNCCYCLES:  '-1'
  EK1100:
  - EL1008
  - EL1008
  - EL1008
  - EL1008
  - EL2008
  - EL2008
  - EL7342
  - EL7342
  - EL9576
  - EL6900
  - EL1904
  - EL2904
  - EL9505

REMAP:
  lcec.0.7.srv-0-cmd:  'cmd_motor_1.7'
  lcec.0.7.srv-1-cmd:  'cmd_motor_2.7'
  lcec.0.8.srv-0-enable:  'status_motor_1.8'
  lcec.0.8.srv-1-enable:  'status_motor_2.8'
  lcec.0.2.din-6-not:  'R_swtich'
  lcec.0.2.din-4-not:  'L_switch'

With remap we are having just all that we want to be listed on ROS topics. @gurnarok

jjrbfi commented 2 years ago

As quick found I got, seems like we have to get the values from pdo values from each terminal file document in order to "remap" the output directly in the ethercat-conf.xml as I saw in this example:

image

Isn't hard to get those values and work on it but if we are going to create a script that made those will be a bit tricky maybe to iterate in this kind of .xml files.

I'm waiting if got some more information to know if we can remap the port without doing in that way.

@gurnarok

jjrbfi commented 2 years ago

I just found a way to rename the terminal name, not the whole pin name directly from the .xml file.

image

Looks like this: image

How that looks to you? @gurnarok

gurnarok commented 2 years ago

We could use this with the YAML file, creating something like this:

ETHERCAT:
  MASTERIDX:  0
  APPTIMEPERIOD:  1000000
  REFCLOCKSYNCCYCLES:  -1
  SLAVES:
  - EK1100
  - EL1008
  - EL1008
  - EL1008
  - EL1008
  - EL2008
  - EL2008
  - EL7342: {name: 'motor1'}
  - EL7342: {name: 'motor2'}
  - EL9576
  - EL6900
  - EL1904
  - EL2904
  - EL9505

I could create XML file with named parts

jjrbfi commented 2 years ago

We could use this with the YAML file, creating something like this:

ETHERCAT:
  MASTERIDX:  0
  APPTIMEPERIOD:  1000000
  REFCLOCKSYNCCYCLES:  -1
  SLAVES:
  - EK1100
  - EL1008
  - EL1008
  - EL1008
  - EL1008
  - EL2008
  - EL2008
  - EL7342: {name: 'motor1'}
  - EL7342: {name: 'motor2'}
  - EL9576
  - EL6900
  - EL1904
  - EL2904
  - EL9505

I could create XML file with named parts

Yes, looks good to me. Doing that will be easier to know faster from what terminal we are interacting with for example. Instead reading some document to know that terminal is the first EL7342 and so.

But now came to my mind that we have to declare the idx also from that .YAML file. Because there can be some cases that we map those in another order.

Also right now that we got working TwinSAFE the .XML will look a bit different with more parameters (modParam) label:

<masters>
<master idx="0" appTimePeriod="100000" refClockSyncCycles="-1">
<slave idx="0" type="EK1100"/>
<slave idx="1" type="EL1008"/>
<slave idx="2" type="EL1008"/>
<slave idx="3" type="EL1008"/>
<slave idx="4" type="EL1008"/>
<slave idx="5" type="EL2008"/>
<slave idx="6" type="EL2008"/>
<slave idx="7" type="EL7342"/>
<slave idx="8" type="EL7342"/>
<slave idx="9" type="EL9576"/>
<slave idx="10" type="EL6900">
  <modParam name="fsoeSlaveIdx" value="11"/>
  <modParam name="fsoeSlaveIdx" value="12"/>
</slave>
<slave idx="11" type="EL1904"/>
<slave idx="12" type="EL2904"/>
<slave idx="13" type="EL9505"/>
</master>
</masters>
jjrbfi commented 2 years ago

As referred here https://github.com/rokokoo/hal_core/issues/2#issuecomment-943227954

There is some work done with ROS, maybe we can skip some of the work we have done here or implement there to have that more customizable.