calssicladder and ethercat

More
05 Apr 2022 09:53 #239311 by db1981
Replied by db1981 on topic calssicladder and ethercat
then the complicated part is homing. How is homing done with this axis? Switch connected to the drive?

i would build this in the following way:

drive <- cia402_comp <- control component
<- simple_tp <-

you have to write ladder logic or c comp that handles control states and position value of your axis and calculates the target pos for the simple_tp. This comp then could be controlled by M Commans or Gui pins.

1) Homing : disable simple_tp, enable the axis, start the homing function in the drive through cia402, if homing is finished set your axis_pos variable to zero

2)position mode , set the target_pos from simple tp to the desired value

3)jog mode : simple_tp target_pos = target_pos +- joc_increment

4)continous jog : create a variable that holds an cont_jog_factor (very small 0.0000xxx)
as long as the jog button is pressed increase/decrease the targe_pos in every cycle with the cont_jog_factor . This is the easyst way, so you don't need to calc with accel/deccel or velocity. try and error with the factor and ready....

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

More
05 Apr 2022 10:57 - 05 Apr 2022 11:13 #239314 by bkt
Replied by bkt on topic calssicladder and ethercat
actually I make exactly these ....
######  float var management -- fake drive axis y  ######################################
#simple-tp.0.target-pos float in #target position to plan for.                          #
#simple-tp.0.maxvel float in #Maximum velocity                                          #
#simple-tp.0.maxaccel float in  #Acceleration rate                                      #
#simple-tp.0.enable bit in #If disabled, planner sets velocity to zero immediately.     #
#simple-tp.0.current-pos float out #position commanded at this point in time.           #
#simple-tp.0.current-vel float out #velocity commanded at this moment in time.          #
#simple-tp.0.active bit out #if active is true, the planner is requesting movement.     #
#########################################################################################

setp simple-tp.0.maxaccel 200
setp simple-tp.0.maxvel 60


########################################
######  halui ladder management ########
########################################

net mdi0 classicladder.0.out-249 => halui.mdi-command-00                    #MDI - command for vince ZERO Yes an other axis but MDI cmd for these is enought
net mdi1 classicladder.0.out-248 => halui.mdi-command-01                    #MDI - command for traslo ZERO
net mdi2 classicladder.0.out-247 => halui.mdi-command-02                    #MDI - command for traslo MAX
net mdi3 classicladder.0.out-246 => halui.mdi-command-03                    #MDI - command soubroutine for vince
net mdi4 classicladder.0.out-245 => halui.mdi-command-04                    #MDI - command soubroutine for traslo

net remote_mdi0 => classicladder.0.in-229
net remote_mdi1 => classicladder.0.in-228
net remote_mdi2 => classicladder.0.in-227
net remote_mdi3 => classicladder.0.in-226
net remote_mdi4 => classicladder.0.in-225
net traslo_down  => classicladder.0.in-223   #these is pyvcp button
net traslo_up    => classicladder.0.in-224   #these is pyvcp button
net traslo_cmd   => classicladder.0.in-222   #these is pyvcp button


net traslo-vel-0 classicladder.0.s32out-00 => convVEL1.in
net traslo-pos-0 classicladder.0.s32out-01 => convVEL2.in
net traslo-vel-1 convVEL1.out => halui.axis.jog-speed #simple-tp.0.current-vel #halui.axis.jog-speed
net traslo-pos-1 convVEL2.out => simple-tp.0.target-pos

net traslo_cmd_1 classicladder.0.out-222 => simple-tp.0.enable mux2.0.sel  #simple-tp.0.active


net Yaxe_fb  joint.1.motor-pos-fb <= lcec.0.1.posActual => trasloPOSup.in1 trasloPOSdown.in1
net Yaxe_cmd-0 joint.1.motor-pos-cmd => mux2.0.in0
net Yaxe_cmd-1 simple-tp.0.current-pos => mux2.0.in1
net Yaxe_cmd-2 mux2.0.out => lcec.0.1.posCommand


obviusly targhet pos was "choose" from classicladder logic .... actually I press 1 pyvcp button for position "1", CL set desired pos, than timer after 1 sec switch mux and enable for simple-tp ....  the same for position "2" ....
but obtain everytime    "joint 1 following error" ....

regards


 
Last edit: 05 Apr 2022 11:13 by bkt.

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

More
05 Apr 2022 11:34 #239321 by db1981
Replied by db1981 on topic calssicladder and ethercat
I don't understand.
I thought this should be an stand alone axis.

But now it is connected to joint.1 ?
The following user(s) said Thank You: bkt

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

More
05 Apr 2022 13:52 - 05 Apr 2022 18:33 #239336 by bkt
Replied by bkt on topic calssicladder and ethercat
When reply you ... code show was just write ... with no suggestion your side after uising simple-tp comp.

SO not used your cia402 comp ....
Last edit: 05 Apr 2022 18:33 by bkt.

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

More
05 Apr 2022 18:23 - 05 Apr 2022 18:31 #239367 by bkt
Replied by bkt on topic calssicladder and ethercat
sorry not remeber your componenet .... so your suggest was :

loadrt cia402 count=1

Right?

But not clear how to switch from joint.1 to simple_tp .... read these exaple upload from your zip file ...
###########################################################
#
# CIA 402 example snippet Hal
#
###########################################################

###########################################################
# Setup
###########################################################

loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS

loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=3
loadrt pid names=x-pid,y-pid,z-pid


###########################################################
# Functions servo-thread
###########################################################

addf lcec.read-all servo-thread
addf cia402.0.read-all servo-thread
addf cia402.1.read-all servo-thread
addf cia402.2.read-all servo-thread

addf motion-command-handler servo-thread
addf motion-controller servo-thread

addf x-pid.do-pid-calcs servo-thread
addf y-pid.do-pid-calcs servo-thread
addf z-pid.do-pid-calcs servo-thread

addf cia402.0.write-all servo-thread
addf cia402.1.write-all servo-thread
addf cia402.2.write-all servo-thread
addf lcec.write-all servo-thread

#########################################
#nets
#########################################
net emc-enable => iocontrol.0.emc-enable-in
sets emc-enable 1

#config
setp cia402.0.csp-mode 1
setp cia402.0.pos-scale 3600

#from servo(ethercat) to cia402
net x-statusword      lcec.0.0.cia-statusword => cia402.0.statusword
net x-opmode-display  lcec.0.0.opmode-display => cia402.0.opmode-display
net x-drv-act-pos     lcec.0.0.actual-position => cia402.0.drv-actual-position
net x-drv-act-velo    lcec.0.0.actual-velocity => cia402.0.drv-actual-velocity

#from cia402 to servo(ethercat)
net x-controlword         cia402.0.controlword => lcec.0.0.cia-controlword
net x-modes-of-operation  cia402.0.opmode => lcec.0.0.opmode
net x-drv-target-pos      cia402.0.drv-target-position => lcec.0.0.target-position
net x-drv-target-velo     cia402.0.drv-target-velocity => lcec.0.0.target-velocity

#from motion to cia
net x-enable    <= joint.0.amp-enable-out => cia402.0.enable
net x-amp-fault => joint.0.amp-fault-in   <= cia402.0.drv-fault
net x-pos-cmd   <= joint.0.motor-pos-cmd  => cia402.0.pos-cmd
net x-pos-fb    => joint.0.motor-pos-fb   <= cia402.0.pos-fb

#homing
net x-home-index <= joint.0.index-enable  => cia402.0.home
how can switch from cia402.0.drv-target-position to simple-tp.0.target-pos?? with mux2 comp is ok?

Plus At these point homing can bring from EL1008 input pin or not? Not understand but seems need to use index from encoder? Is right?
Last edit: 05 Apr 2022 18:31 by bkt.

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

More
05 Apr 2022 21:13 #239390 by db1981
Replied by db1981 on topic calssicladder and ethercat
i am on tour......

for using cia comp the home switch has to be connect to the drive.

component order :

lcec device <- cia comp -< simple tp

this means:

simple_tp output (current_pos) -> cia pos input (pos-cmd)

simple_tp target_pos is your position input.
The following user(s) said Thank You: bkt

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

More
06 Apr 2022 19:57 #239468 by bkt
Replied by bkt on topic calssicladder and ethercat
i've some trouble with your cia402 ..... are you sure that can use these axis as stand alone axis and other 3 axis in cnc way at same time? So 3 axis in gcode and one as stand alone at same time?

thanks

bkt

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

More
06 Apr 2022 20:10 #239469 by db1981
Replied by db1981 on topic calssicladder and ethercat
yes, you can use so much you want. This is only a kind of hardware driver/glue layer.

what kind of troubles?

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

More
07 Apr 2022 05:47 #239506 by bkt
Replied by bkt on topic calssicladder and ethercat
seems xml was not right recognised .... but i'm out now .... can update you in 1 hour.

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

More
09 Apr 2022 11:31 - 09 Apr 2022 12:43 #239725 by bkt
Replied by bkt on topic calssicladder and ethercat
All know that my 1 hour can be so long ... sorry for delay ... any how today return on project ...

because someone told to me that is possible mix old style xml with cia402 these is my xml ... and above screenshot o error ...

<masters>
<master idx="0" appTimePeriod="2000000" 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="E0"/></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="71750"/>
      </pdo>
    </syncManager>
    <syncManager idx="3" dir="in">
      <pdo idx="1A01">
        <pdoEntry idx="603F" subIdx="00" bitLen="16" halPin="errorStat" halType="bit"/>
        <pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="driverStatus" halType="bit"/>
        <pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="posActual" halType="float" scale="0.000013937"/>
        <pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="velActual" halType="float" scale="0.000013937"/>
        <pdoEntry idx="6077" subIdx="00" bitLen="16" halPin="torkStat" halType="float" scale="0.1"/>
      </pdo>
    </syncManager>
    <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="500000"/>
    <slave idx="1" type="generic" vid="000007DD" pid="01" configPdos="true">
      <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
      <syncManager idx="2" dir="out">
        <pdo idx="1601">
          <pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
          <pdoEntry idx="6060" subIdx="00" bitLen="8" halPin="opmode" halType="s32"/>
          <pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
          <pdoEntry idx="60FF" subIdx="00" bitLen="32" halPin="target-velocity" halType="s32"/>
        </pdo>
      </syncManager>
      <syncManager idx="3" dir="in">
        <pdo idx="1a01">
          <pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="cia-statusword" halType="u32"/>
          <pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="opmode-display" halType="s32"/>
          <pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="actual-position" halType="s32"/>
          <pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
          <pdoEntry idx="6077" subIdx="00" bitLen="32" halPin="actual-torque" halType="s32"/>
        </pdo>
      </syncManager>
    </slave>


I ask to someone ... and He told that is possible mix old style xml and cia402 .... so that my xml .... error on Lcnc was:



row 17 of my hal file report:
loadusr -W lcec_conf /home/linuxcnc/configs/axis.cld/gc_plc_ax.xml


So i'm little bit confused .... but for sure not see some mistake ...

bkt
Attachments:
Last edit: 09 Apr 2022 12:43 by bkt.

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

Time to create page: 0.352 seconds
Powered by Kunena Forum