More than 9 axes with servo

More
15 Aug 2018 10:36 - 15 Aug 2018 10:42 #116077 by Ilya
Hello everyone
I have read this topic and as I understand it - I can't use M67 or M68 for pid

We are building a machine for processing logs, for this I need 11 axes and 12 motors.
A minimum of 6 interpolated axes (7 joints as the X-axis is gantry)
6 axes (XXYZABC) - for processing(engraving, milling, Etc)

5 axes will have to drive up to the right place and fix the log. It is necessary when you have to cut it in half.
They do not need to be interpolated, but they need to be able to manage them through both the MDI and the control program.

I use the servo Delta ASD-A2-E ethercat running, and LinuxCNC 2.8 pre~

I would appreciate any help and ideas
Thanks,
ilya
Last edit: 15 Aug 2018 10:42 by Ilya.

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

More
15 Aug 2018 16:52 #116087 by Todd Zuercher
That topic doesn't say that at all.

First lets straighten you out on what an axis is in Linuxcnc. As of 2.8-pre the current Master development branch (before this the definition is somewhat muddled) an "axis" refers to a Cartesian coordinate in space, and is limited to X,Y,Z (linear), A,B,C (rotary), plus 3 additional linear U,V,W.

In Linuxcnc, Joints refer to the actual physical pieces of the machine that move the machine or each motor driving some part of the machine. I am not sure if these are or are not actually limited to only 9 in Master. (I haven't played with 2.8-pre much.) Joints are associated with and move the axis coordinates via the kinematic module that is loaded in the configuration.

A servo could also be commanded with a pid loop directly and not be associated with a joint or axis. This is what is being suggested by using M67 or M68 commands to change the postion command to the pid loop. Other components such as limit3 could (should) be used between the command input (M67/M68) and the pid to help control and smooth the motion created by the commands.

However I'm not sure that you would be using a pid loop in linuxcnc with those Eithercat drives? You might just be directly sending positioning commands directly to the drives and they would be handling the loops internally.
The following user(s) said Thank You: Ilya

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

More
17 Aug 2018 06:05 - 17 Aug 2018 06:44 #116190 by Ilya
Replied by Ilya on topic More than 9 axes with servo
I was trying to connect the motion.analog-out-00 and x-pid.comand pins, But it certainly doesn't work
I can't control the drive by position using halcmd, only by speed

I don't know what happens behind the scenes when I, for example, use the command "G0 X1000". Maybe it would help me

Here is part of my working configuration (If you want, I can upload the full file):
# position controler
setp x-pid.Pgain [JOINT_0]P
setp x-pid.Igain [JOINT_0]I
setp x-pid.Dgain [JOINT_0]D
setp x-pid.FF0 [JOINT_0]FF0
setp x-pid.FF1 [JOINT_0]FF1
setp x-pid.FF2 [JOINT_0]FF2
setp x-pid.deadband [JOINT_0]DEADBAND
setp x-pid.maxoutput [JOINT_0]MAX_OUTPUT
net x-enable => x-pid.enable
net x-pos-cmd => x-pid.command
net x-pos-fb => x-pid.feedback
net x-vel-cmd <= x-pid.output

# axis interface

net x-home-sw-in => joint.0.home-sw-in
net x-enable <= joint.0.amp-enable-out
net x-amp-fault => joint.0.amp-fault-in
net x-pos-cmd <= joint.0.motor-pos-cmd
net x-pos-fb => joint.0.motor-pos-fb
net x-pos-joint <= joint.0.pos-fb
net x-homed <= joint.0.homed
net x-homing <= joint.0.homing
net x-neg-lim-in => joint.0.neg-lim-sw-in
net x-pos-lim-in => joint.0.pos-lim-sw-in

# * lcec - component for working with Ethercat

# voltage is statically enabled as soon as LCNC is running
setp lcec.0.3A1.srv-enable-volt 1
# set motor position scale (default 1 motor revolution)
setp lcec.0.3A1.pos-scale [JOINT_0]SCALE
setp lcec.0.3A1.extenc-scale [JOINT_0]ENC_SCALE
# switch on if joint is enables
# this signal is used for the fault autoreset feature, too
net x-enable => lcec.0.3A1.srv-switch-on
# enable operation if joint is enabled
# The delta driver internally delay this signal
# till switched-on feedback is set to 1
net x-enable => lcec.0.3A1.srv-enable
# check driver fault status
net x-amp-fault <= lcec.0.3A1.srv-fault
# output velocity command from position control
# the scale of this value respects the setting
# of srv-pos-scale. if scale is set to 1.0 this
# means 1 motor revolution per second.
net x-vel-cmd => lcec.0.3A1.srv-vel-cmd
# motor encoder position is used as joint
# position feedback
net x-pos-fb <= lcec.0.3A1.enc-pos
#net x-index x-pid.index-enable lcec.0.3A1.enc-index-ena

thanks,
ilya
Last edit: 17 Aug 2018 06:44 by Ilya.

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

More
17 Aug 2018 18:22 - 17 Aug 2018 18:23 #116218 by Todd Zuercher
To send a position command to that servo, you will have to disconnect it from the joint.0.motor-pos-cmd. and to prevent following errors you would also need to do something to fool the joint.0.motor-pos-fb.

For your test it might be simpler to set up a new pid loop that isn't already connected to a joint/axis. There is a lot of little things that would need to be faked, fooled or manipulated in some way to separate it from the old system.

All you should need is a pid loop that you send a position command to. Connect the output of the PID to the velocity command input of your servo, And connect the encoder feedback to the PID's feedback input. Oh, and some way to enable/disable the drive.
Last edit: 17 Aug 2018 18:23 by Todd Zuercher.
The following user(s) said Thank You: Ilya

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

More
20 Aug 2018 13:58 #116375 by andypugh

All you should need is a pid loop that you send a position command to. Connect the output of the PID to the velocity command input of your servo, And connect the encoder feedback to the PID's feedback input. Oh, and some way to enable/disable the drive.


Once this is working it might be useful to interpose a Limit3 component between the motion.analog-out and the pid.command
This could then have its velocity limit pin connected to a second motion.analog-out in order to control both the speed and final position of the movement.
The following user(s) said Thank You: Ilya

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

More
23 Aug 2018 05:45 #116474 by Ilya
Replied by Ilya on topic More than 9 axes with servo
Thanks to Todd and Andy for your advices! They were very useful. Limit3 component is just great!
For the test, i had to connect joint.0.amp-enable-out to two servos and two PIDs. If I don't come up with something smarter, I'll have to do it for four servos at once..
Here's what works now:
setp n1-pid.Pgain [JOINT_3]P
setp n1-pid.Igain [JOINT_3]I
setp n1-pid.Dgain [JOINT_3]D
setp n1-pid.FF0 [JOINT_3]FF0
setp n1-pid.FF1 [JOINT_3]FF1
setp n1-pid.FF2 [JOINT_3]FF2
setp n1-pid.deadband [JOINT_3]DEADBAND
setp n1-pid.maxoutput [JOINT_3]MAX_OUTPUT
net x-enable => n1-pid.enable

net n1-m68-to-limit3 motion.analog-out-00 => limit3.0.in
setp limit3.0.min -1000
setp limit3.0.max 1000
setp limit3.0.maxa 200
setp limit3.0.maxv 100
setp limit3.0.smooth-steps 10
net n1-limit3-to-pid limit3.0.out => n1-pid.command 

net n1-pos-fb => n1-pid.feedback
net n1-vel-cmd <= n1-pid.output

setp lcec.0.3A4.srv-enable-volt 1
setp lcec.0.3A4.pos-scale [JOINT_3]SCALE
setp lcec.0.3A4.extenc-scale [JOINT_3]ENC_SCALE
net x-enable => lcec.0.3A4.srv-switch-on
net x-enable => lcec.0.3A4.srv-enable
net n1-amp-fault <= lcec.0.3A4.srv-fault
net n1-vel-cmd => lcec.0.3A4.srv-vel-cmd 
net n1-pos-fb <= lcec.0.3A4.enc-pos 
net n1-brake <= lcec.0.3A4.srv-oper-enabled

Now i have to figure out how to do the homing for that axis

thanks,
Ilya

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

More
23 Aug 2018 10:00 #116478 by andypugh
Homing is harder. The most elegant solution is probably to create a modified Limit3 component with homing as a built-in behaviour.

It can be done with a combination of sample-hold and offset .
Well, you could use sample-hold if it wasn't limited to S32 data anyway. For floating point data (like axis position) you actually need to use a mux2 component with the output looped back to the input.

When the limit switch is tripped you store the current position command in the sample-hold and that is used to offset the command and feedback to the limit-switch origin. There are wrinkles here, such as a sudden large following error and a step change in PID inputs, which is why either a modified Limit3 or a dedicated extra-axis-homing component might be a better idea.

In an ideal world LinuxCNC would simply allow many more joints than axes and would home them along with all the others.

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

More
24 Aug 2018 13:29 - 24 Aug 2018 13:43 #116544 by Ilya
Replied by Ilya on topic More than 9 axes with servo
I could not understand how to work with the sample_hold component, I always get 0 at the output :(

I also found an lcec.0.3A4.enc-pos-reset pin, which resets the encoder values.
As a result, I made a simultaneous reset of lcec.0.3A4.enc-pos and motion.analog-out-00 using the test python script:
            hal.set_p("lcec.0.3A4.enc-pos-reset","1" )
            hal.set_p("limit3.0.load","1")
            linuxcnc.command().mdi("M68 E0 Q0")
            hal.set_p("limit3.0.load","0")
            hal.set_p("lcec.0.3A4.enc-pos-reset","0")

how bad or good do you think this decision is? What could be the problem?

thanks,
ilya
Last edit: 24 Aug 2018 13:43 by Ilya.

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

More
24 Aug 2018 14:08 #116546 by andypugh
That should be fine. I was trying to think of a less hardware-specific solution.
The following user(s) said Thank You: Ilya

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

Time to create page: 0.091 seconds
Powered by Kunena Forum