Ethercat HAL driver

More
07 Feb 2021 20:51 #197953 by JKAVS
Replied by JKAVS on topic Ethercat HAL driver
@db1981

I have read so from this thread.

Please Log in or Create an account to join the conversation.

More
07 Feb 2021 21:35 #197958 by db1981
Replied by db1981 on topic Ethercat HAL driver
okay, there are 2 different pieces:

-the generic ethercat driver (part of linuxcnc ethercat) runs at your servo thread

-the generic network card driver for the ethercat master. This driver can have much more jitter then an dedicated driver for your network chip, in an realtime environment.

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 08:16 - 08 Feb 2021 08:16 #197976 by JKAVS
Replied by JKAVS on topic Ethercat HAL driver
@db1981

I'm talking about the generic Ethercat driver. The one that needs a custom XML-file but can used with almost any Ethercat device. Somewhere in this thread was concerns that it is not fast enough for servo drives.
Last edit: 08 Feb 2021 08:16 by JKAVS.

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 09:41 #197977 by db1981
Replied by db1981 on topic Ethercat HAL driver
That's wrong! there are no speed/cycle time differences between the generic or an special generated ethercat driver.
The following user(s) said Thank You: Nico2017

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 10:31 #197978 by JKAVS
Replied by JKAVS on topic Ethercat HAL driver
Maybe I have mixed up the two generic drivers. I browsed the thread back and found a post where it was said that the generic network card driver is slower.

That shouldn't be a problem for me. At least my card is one which should have a specific driver.

Please Log in or Create an account to join the conversation.

More
09 Feb 2021 19:32 - 11 Feb 2021 14:19 #198189 by bkt
Replied by bkt on topic Ethercat HAL driver
I have a big problem, I can't configure my axis, I can make it move smoothly but I can't drive it in velocity mode .... not because there isn't something wrong, but I think it just comes from a lot of confusion that I'm doing ... I use the generic drive speed profile and I can't figure out which parameters compared to the classic mesa 7i77 configuration I have to insert .... I insert an excerpt of my xml to understand the nomenclature .... and an excerpt from the file. hal ....

/* xml */
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1">
  <slave idx="0" type="generic" vid="000007DD" pid="01" configPdos="true">
	<sdoConfig idx="6060" subIdx="0"><sdoDataRaw data="08"/></sdoConfig>
	<sdoConfig idx="60C2" subIdx="1"><sdoDataRaw data="01"/></sdoConfig>
	<sdoConfig idx="60C2" subIdx="2"><sdoDataRaw data="FD"/></sdoConfig>
	<sdoConfig idx="607E" subIdx="0"><sdoDataRaw data="00"/></sdoConfig>
	<!-- <sdoConfig idx="607E" subIdx="1"><sdoDataRaw data="E0"/></sdoConfig>
	<sdoConfig idx="6091" subIdx="1"><sdoDataRaw data="0375"/></sdoConfig> /* gear ratio param ... but not work ... so I leave it*/
	<sdoConfig idx="6091" subIdx="2"><sdoDataRaw data="0010"/></sdoConfig>
	<sdoConfig idx="6092" subIdx="1"><sdoDataRaw data="0360"/></sdoConfig>
	<sdoConfig idx="6092" subIdx="2"><sdoDataRaw data="0168"/></sdoConfig> /* questo non và settato*/ -->
    <syncManager idx="0" dir="out"></syncManager>
    <syncManager idx="1" dir="in"></syncManager>
    <syncManager idx="2" dir="out">
      <pdo idx="1601">
        <pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="driverControl" halType="bit"/>
        <pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="posCommand" halType="float" scale="14000"/>
      </pdo>
    </syncManager>
    <syncManager idx="3" dir="in">
      <pdo idx="1A01">
        <pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="driverStatus" halType="bit"/>
        <pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="posActual" halType="float" scale="0.000071429"/>
        <pdoEntry idx="6077" subIdx="00" bitLen="16" halPin="torActual" halType="float"/>
        <pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="velActual" halType="float"/>
        <pdoEntry idx="603F" subIdx="00" bitLen="16" halPin="errorStat" halType="float"/>
      </pdo>
    </syncManager>
    <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-250000" sync1Cycle="0" sync1Shift="0"/>
    <watchdog divider="2050" intervals="1000"/>
  </slave>

/* .hal*/
#*******************
#  AXIS X
#*******************

setp   pid.x.Pgain     [JOINT_0]P
setp   pid.x.Igain     [JOINT_0]I
setp   pid.x.Dgain     [JOINT_0]D
setp   pid.x.bias      [JOINT_0]BIAS
setp   pid.x.FF0       [JOINT_0]FF0
setp   pid.x.FF1       [JOINT_0]FF1
setp   pid.x.FF2       [JOINT_0]FF2
setp   pid.x.deadband  [JOINT_0]DEADBAND
setp   pid.x.maxoutput [JOINT_0]MAX_OUTPUT
setp   pid.x.error-previous-target true

net x-index-enable  <=> pid.x.index-enable
net x-enable        =>  pid.x.enable
net x-pos-cmd       =>  pid.x.command
net x-vel-cmd       =>  pid.x.command-deriv
net x-pos-fb        =>  pid.x.feedback
net x-output        =>  pid.x.output
# these part is ok no need help#

# ---PWM Generator signals/setup--- IN ETHERCAT there is no analog signal generator so I think it can be removed 

#setp   hm2_5i25.0.7i77.0.1.analogout0-scalemax  [JOINT_0]OUTPUT_SCALE
#setp   hm2_5i25.0.7i77.0.1.analogout0-minlim    [JOINT_0]OUTPUT_MIN_LIMIT
#setp   hm2_5i25.0.7i77.0.1.analogout0-maxlim    [JOINT_0]OUTPUT_MAX_LIMIT
# enable _all_ sserial pwmgens
# net x-enable   hm2_5i25.0.7i77.0.1.analogena

# these signals give me problems .... I have to convert them as it is written in the .hal file that I carry later? 

net x-output     => hm2_5i25.0.7i77.0.1.analogout0 # and these signal ??
net x-pos-cmd    joint.0.motor-pos-cmd => #??
net x-enable     joint.0.amp-enable-out => lcec.0.0.driverControl-3


# ---Encoder feedback signals/setup--- I'm unable to scale encoder raw signal

setp    hm2_5i25.0.encoder.00.counter-mode 0
setp    hm2_5i25.0.encoder.00.filter 1
setp    hm2_5i25.0.encoder.00.index-invert 0
setp    hm2_5i25.0.encoder.00.index-mask 0
setp    hm2_5i25.0.encoder.00.index-mask-invert 0
setp    hm2_5i25.0.encoder.00.scale  [JOINT_0]ENCODER_SCALE

net x-pos-fb               <=  lcec.0.0.posActual #these id right or not?
net x-vel-fb               <=  lcec.0.0.velActual #these id right or not?
net x-pos-fb               =>  joint.0.motor-pos-fb   <= lcec.0.0.posActual #these id right or not?

#actualPos is raw and scaled on xml ... so no need I think. Is right?
#net x-index-enable    joint.0.index-enable  <=>  hm2_5i25.0.encoder.00.index-enable
#net x-pos-rawcounts        <=  hm2_5i25.0.encoder.00.rawcounts

Finally these is a sample find on these infinite post .... there are converted signal ... but if use "scale" into xml file is necessary converter "posActual" signal from/to u32 for perform [JOINT_0]SCALE signal?

/* converted signal sample from these long post */
Translate X Position Feedback
net RawPositionFeedback0 lcec.0.0.Axis1RxPositionFeedback => x_scale_fb.in
setp x_scale_fb.gain [JOINT_0]PSCALE_INV #invert of below
setp x_scale_fb.offset 0
net xpos-fb joint.0.motor-pos-fb <= x_scale_fb.out

# Translate X Position Command
net xpos-cmd joint.0.motor-pos-cmd => x_scale_cmd.in
setp x_scale_cmd.gain [JOINT_0]PSCALE	#invert of above
setp x_scale_cmd.offset 0
net PosCmdX-Scaled x_pos_cmd_u32.in  <= x_scale_cmd.out
net PosCmdX-IntOut x_pos_cmd_u32.out => lcec.0.0.Axis1TxPositionCommand

but if use "scale" into xml file is necessary converter "posActual" signal from/to u32 for perform [JOINT_0]SCALE signal?
I have not found configuration files that could help me to realize the "SCALE" of the encoder signal .... I don't understand how to get there .... is it just a problem of numeric conversions?

Thanks in advances for any help.
bkt
Last edit: 11 Feb 2021 14:19 by bkt. Reason: some type of error copiing xml

Please Log in or Create an account to join the conversation.

More
09 Feb 2021 19:55 #198191 by db1981
Replied by db1981 on topic Ethercat HAL driver
Hello,

what servo drives are this?

your configured PDOs look like position mode, but you trying to output an velocity command.
Probably the drive has its own position control loop running, then using an additionaly PID in Linuxcnc is wrong.

Please Log in or Create an account to join the conversation.

More
10 Feb 2021 09:04 #198252 by bkt
Replied by bkt on topic Ethercat HAL driver
You are in right .... my error I post the old xml in position mode .... I correct immediately.

regards
bkt

Please Log in or Create an account to join the conversation.

More
10 Feb 2021 17:07 - 11 Feb 2021 14:22 #198295 by bkt
Replied by bkt on topic Ethercat HAL driver
After many and many attempts, I put back the synchro position mode. I'm carrying a piece of xml. I have a mechanical reduction of 37.5 my drive has a resolution of 131672 puls / rev (17bit) and with this hal and ini configuration I get the required movement of + and - 90 ° on my joint .... what is it that I don't have I got it? In fact, the scale factor on the xml file was reached by attempts without any apparent logic .... the method escapes me even if I have reached the goal.

My xml file:
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1">
  <slave idx="0" type="generic" vid="000007DD" pid="01" configPdos="true">
	<sdoConfig idx="6060" subIdx="0"><sdoDataRaw data="08"/></sdoConfig>
	<sdoConfig idx="60C2" subIdx="1"><sdoDataRaw data="01"/></sdoConfig>
	<sdoConfig idx="60C2" subIdx="2"><sdoDataRaw data="FD"/></sdoConfig>
	<sdoConfig idx="607E" subIdx="0"><sdoDataRaw data="00"/></sdoConfig>
    <syncManager idx="0" dir="out"></syncManager>
    <syncManager idx="1" dir="in"></syncManager>
    <syncManager idx="2" dir="out">
      <pdo idx="1601">
        <pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="driverControl" halType="bit"/>
        <pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="posCommand" halType="float" scale="14000"/>
      </pdo>
    </syncManager>
    <syncManager idx="3" dir="in">
      <pdo idx="1A01">
        <pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="driverStatus" halType="bit"/>
        <pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="posActual" halType="float" scale="0.000071429"/>
      </pdo>
    </syncManager>
    <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-250000" sync1Cycle="0" sync1Shift="0"/>
    <watchdog divider="2050" intervals="1000"/>
  </slave>
  <slave idx="1" type="generic" vid="000007DD" pid="01" configPdos="true">
	<sdoConfig idx="6060" subIdx="0"><sdoDataRaw data="08"/></sdoConfig>
	<sdoConfig idx="60C2" subIdx="1"><sdoDataRaw data="01"/></sdoConfig>
	<sdoConfig idx="60C2" subIdx="2"><sdoDataRaw data="FD"/></sdoConfig>
	<sdoConfig idx="607E" subIdx="0"><sdoDataRaw data="00"/></sdoConfig>
    <syncManager idx="0" dir="out"></syncManager>
    <syncManager idx="1" dir="in"></syncManager>
    <syncManager idx="2" dir="out">
      <pdo idx="1601">
        <pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="driverControl" halType="bit"/>
        <pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="posCommand" halType="float" scale="14000"/>
      </pdo>
    </syncManager>
    <syncManager idx="3" dir="in">
      <pdo idx="1A01">
        <pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="driverStatus" halType="bit"/>
        <pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="posActual" halType="float" scale="0.000071429"/>
      </pdo>
    </syncManager>
    <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-250000" sync1Cycle="0" sync1Shift="0"/>
    <watchdog divider="2050" intervals="1000"/>
  </slave>
  <slave idx="2" type="generic" vid="000007DD" pid="01" configPdos="true">
	<sdoConfig idx="6060" subIdx="0"><sdoDataRaw data="08"/></sdoConfig>
	<sdoConfig idx="60C2" subIdx="1"><sdoDataRaw data="01"/></sdoConfig>
	<sdoConfig idx="60C2" subIdx="2"><sdoDataRaw data="FD"/></sdoConfig>
	<sdoConfig idx="607E" subIdx="0"><sdoDataRaw data="00"/></sdoConfig>
    <syncManager idx="0" dir="out"></syncManager>
    <syncManager idx="1" dir="in"></syncManager>
    <syncManager idx="2" dir="out">
      <pdo idx="1601">
        <pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="driverControl" halType="bit"/>
        <pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="posCommand" halType="float" scale="14000"/>
      </pdo>
    </syncManager>
    <syncManager idx="3" dir="in">
      <pdo idx="1A01">
        <pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="driverStatus" halType="bit"/>
        <pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="posActual" halType="float" scale="0.000071429"/>
      </pdo>
    </syncManager>
    <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="-250000" sync1Cycle="0" sync1Shift="0"/>
    <watchdog divider="2050" intervals="1000"/>
  </slave>




  <slave idx="3" type="EK1100" name="Busklemme"/>
  <slave idx="4" type="EL1008"/>
  <slave idx="5" type="EL2008"/>
</master>
</masters>


My pieces of .hal file:
loadusr -W lcec_conf /home/my/linuxcnc/configs/et-3ax/cia402v1.xml
loadrt lcec

loadrt [KINS]KINEMATICS
setp rotarydeltakins.platformradius 190.00
setp rotarydeltakins.thighlength 340.0
setp rotarydeltakins.shinlength 800.0
setp rotarydeltakins.footradius 74.

#autoconverted  trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS 
loadrt conv_u32_float names=cu32f.0,cu32f.1,cu32f.2
loadrt toggle count=1


addf lcec.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf lcec.write-all servo-thread
addf cu32f.0 servo-thread
addf cu32f.1 servo-thread
addf cu32f.2 servo-thread
addf toggle.0 servo-thread

net ec-slaves-responding <= lcec.slaves-responding
net ec-link-up <= lcec.link-up
net ec-all-op <= lcec.all-op

net ec_up lcec.state-op => iocontrol.0.emc-enable-in lcec.0.0.driverControl-0 lcec.0.1.driverControl-0 lcec.0.2.driverControl-0

 
setp lcec.0.0.driverControl-1 1
setp lcec.0.0.driverControl-2 1
setp lcec.0.1.driverControl-1 1
setp lcec.0.1.driverControl-2 1
setp lcec.0.2.driverControl-1 1
setp lcec.0.2.driverControl-2 1

#net faultReset-All lcec.0.0.driverControl-7 <= esternalCmd => lcec.0.0.driverControl-7 lcec.0.1.driverControl-7 lcec.0.2.driverControl-7
#net faultSignal-0 lcec.0.0.driverStatus-3 => esternalSignal-0
#net faultSignal-1 lcec.0.1.driverStatus-3 => esternalSignal-1
#net faultSignal-2 lcec.0.2.driverStatus-3 => esternalSignal-2
#net faultSignal-3 lcec.0.3.driverStatus-3 => esternalSignal-3


net Xaxe_on joint.0.amp-enable-out => lcec.0.0.driverControl-3 
net Yaxe_on joint.1.amp-enable-out => lcec.0.1.driverControl-3 
net Zaxe_on joint.2.amp-enable-out => lcec.0.2.driverControl-3 

net Xaxe_fb joint.0.motor-pos-fb <= lcec.0.0.posActual
net Xaxe_cmd joint.0.motor-pos-cmd => lcec.0.0.posCommand
net Yaxe_fb  joint.1.motor-pos-fb <= lcec.0.1.posActual
net Yaxe_cmd joint.1.motor-pos-cmd => lcec.0.1.posCommand
net Zaxe_fb  joint.2.motor-pos-fb <= lcec.0.2.posActual
net Zaxe_cmd joint.2.motor-pos-cmd => lcec.0.2.posCommand

My piece of ini file for X axes for example (other is the same):
[AXIS_X]
MIN_LIMIT = -45000
MAX_LIMIT = 45000
MAX_VELOCITY = 7000.0
MAX_ACCELERATION = 2000.0

[JOINT_0]
TYPE = ANGULAR
#TYPE = LINEAR
MAX_VELOCITY = 3600.0
MAX_ACCELERATION = 650.0
STEPGEN_MAXACCEL = 0
SCALE = 1 
FERROR = 2
MIN_FERROR = 20
MIN_LIMIT = -90
MAX_LIMIT = 90
#HOME_ABSOLUTE_ENCODER	= 2
HOME					= 0
HOME_OFFSET				= 0
HOME_SEQUENCE			= 0
HOME_SEARCH_VEL			= 0
#HOME_USE_INDEX			= 1
HOME_LATCH_VEL			= 0
HOME_IGNORE_LIMITS		= yes

Drive is Maxine EP3 in attach some interesting manual page ... for sure value of position is in Dint .... not sure these infuences the system ... I assumed that the conversion to float is automatic.
Attachments:
Last edit: 11 Feb 2021 14:22 by bkt.
The following user(s) said Thank You: besriworld

Please Log in or Create an account to join the conversation.

More
10 Feb 2021 18:47 #198311 by db1981
Replied by db1981 on topic Ethercat HAL driver
sorry, i did not understand what you want to do..

-You want to control the drive in velocity mode?
-You have problem with the pos feedbackvalue? Feedback from the drive is an signed Integer, automatic conversion is not automatic done, every 16 bits, there will be an huge step in the value. I think the feedback is an raw value, so you need something like an counter/encoder logic.

Please Log in or Create an account to join the conversation.

Time to create page: 0.310 seconds
Powered by Kunena Forum