how to synchronize two servomotors

More
9 years 4 months ago #94784 by Todd Zuercher
You have most of the mesa card connections for Y and Y2 set to the same stepgenerator in your hal file. This is very wrong. Linuxcnc failed to start because some of those duplication were trying to connect the same hal pins to different signal names.
You need to figure out which stepgens (and which physical pins on the Mesa card) you have the step driver connected to. If you have Y2 connected to the output that is controlled by stepgen.07 (is that right?) then you need to change everything in the Y2 section from hm2_5i25.0.stepgen.06 to hm2_5i25.0.stepgen.07.
Something like this.
Code:
#******************* # JOINT Y2 #******************* setp pid.y2.Pgain [JOINT_3]P setp pid.y2.Igain [JOINT_3]I setp pid.y2.Dgain [JOINT_3]D setp pid.y2.bias [JOINT_3]BIAS setp pid.y2.FF0 [JOINT_3]FF0 setp pid.y2.FF1 [JOINT_3]FF1 setp pid.y2.FF2 [JOINT_3]FF2 setp pid.y2.deadband [JOINT_3]DEADBAND setp pid.y2.maxoutput [JOINT_3]MAX_OUTPUT setp pid.y2.error-previous-target true #setp pid.y2.maxerror .0005 net y2-index-enable <=> pid.y2.index-enable net y2-enable => pid.y2.enable net y2-pos-cmd => pid.y2.command net y2-vel-cmd => pid.y2.command-deriv net y2-pos-fb => pid.y2.feedback net y2-output => pid.y2.output # Step Gen signals/setup setp hm2_5i25.0.stepgen.07.dirsetup [JOINT_3]DIRSETUP setp hm2_5i25.0.stepgen.07.dirhold [JOINT_3]DIRHOLD setp hm2_5i25.0.stepgen.07.steplen [JOINT_3]STEPLEN setp hm2_5i25.0.stepgen.07.stepspace [JOINT_3]STEPSPACE setp hm2_5i25.0.stepgen.07.position-scale [JOINT_3]STEP_SCALE setp hm2_5i25.0.stepgen.07.step_type 0 setp hm2_5i25.0.stepgen.07.control-type 1 setp hm2_5i25.0.stepgen.07.maxaccel [JOINT_3]STEPGEN_MAXACCEL setp hm2_5i25.0.stepgen.07.maxvel [JOINT_3]STEPGEN_MAXVEL # ---closedloop stepper signals--- net y2-pos-cmd <= joint.3.motor-pos-cmd net y2-vel-cmd <= joint.3.vel-cmd net y2-output <= hm2_5i25.0.stepgen.07.velocity-cmd #net y2-pos-fb <= hm2_5i25.0.stepgen.07.position-fb net y2-pos-fb => joint.3.motor-pos-fb net y2-enable <= joint.3.amp-enable-out net y2-enable => hm2_5i25.0.stepgen.06.enable # ---closedloop stepper signals--- net y2-output => hm2_5i25.0.stepgen.07.velocity-cmd net y2-enable => hm2_5i25.0.stepgen.07.enable # ---Encoder feedback signals/setup--- setp hm2_5i25.0.encoder.04.counter-mode 0 setp hm2_5i25.0.encoder.04.filter 1 setp hm2_5i25.0.encoder.04.index-invert 0 setp hm2_5i25.0.encoder.04.index-mask 0 setp hm2_5i25.0.encoder.04.index-mask-invert 0 setp hm2_5i25.0.encoder.04.scale [JOINT_1]ENCODER_SCALE net y2-pos-fb <= hm2_5i25.0.encoder.04.position net y2-vel-fb <= hm2_5i25.0.encoder.04.velocity net y2-pos-fb => joint.3.motor-pos-fb net y2-index-enable joint.3.index-enable <=> hm2_5i25.0.encoder.04.index-enable net y2-pos-rawcounts <= hm2_5i25.0.encoder.04.rawcounts # ---setup home / limit switch signals--- #net y2-neg-limit <= hm2_5i25.0.7i76.0.0.input-05-not #net y2-pos-limit <= hm2_5i25.0.7i76.0.0.input-04-not net y2-home-sw <= hm2_5i25.0.7i76.0.0.input-17 net y2-home-sw => joint.3.home-sw-in #net y2-neg-limit => joint.3.neg-lim-sw-in #net y2-pos-limit => joint.3.pos-lim-sw-in

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

More
9 years 4 months ago #94785 by Jasper 3
thanks that was defentiv one mistake (y is stepgen6 and y2 is stepgen 7). So know I still get following errors.
I discovered. that one motor rotates backwards. Also this motor has under calibration (in axis) no encoder feedback. If I change the sign. (y stays - ; y2 becomes +) than both motors turn in the same direction. But there still must be an error. Imidetly after moving the y-axis I get either following error 1 or 3.

File Attachment:

File Name: Linuxcnc_P...22-3.hal
File Size:15.42 KB

File Attachment:

File Name: Linuxcnc_P...22-3.ini
File Size:5.37 KB

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

More
9 years 4 months ago #94794 by Todd Zuercher
The first thing you are going to need to do is get the encoder feedback straightened out for each joint.

It might be useful while setting things up if you can see the DROs in Joint mode. To enable that, in your ini file under the [KINS] section change the Kinimatics line to
KINEMATICS = trivkins coordinates=XYZY kinstype=BOTH
Then the joint values will be shown in the DRO.

DO NOT try to jog the y axis joints while in joint mode. As they will not be slaved together in joint mode and doing so will rack your gantry.

Just remember to take that out after the machine is setup so you can't rack the gantry.

With the drives disabled, push the gantry and see if the DROs for both Y joints moves correctly.

Then make the nessisary adjustments to the scales for those joints. (assuming the encoders are wired up and working correctly.) Also be sure that you have the right encoder connected to Y1 and Y2. (that they are not crossed)

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

More
9 years 4 months ago #94796 by Jasper 3
really awesome!
thanks found out that the encoder cables were switched. So no it is working. Just need to tune the axis because the axis oscillates. Or can there be another reason for that oscillations.

Greets

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

More
9 years 4 months ago #94805 by andypugh
Oscillation is almost certainly tuning. Try lowering the P-gain until if stops doing it. (initially).

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

More
9 years 4 months ago #95093 by Jasper 3
hey,
the last days I tried to tune the servos so they run smooth. I tried to connect the couplings between servo and Gantry after I homed my axis and switched everthing on. But nothing worked.
When I run the servos (when they are not connected with the gantry) they run both in the same direction and also they run both with the same speed. So there the driver settings are all correct. Also the Linux settings should be correct.
So It seems, that either the servos cannot run synchronous (maybe because my gantry is to rigid? )or I make something wrong.

Is there any possibility to set something in Linux to run the servos as sychronous as possible?

regards Jasper

File Attachment:

File Name: Linuxcnc_P...6-28.hal
File Size:15.07 KB

The P value is the last one I tried and als the value that worked best.

File Attachment:

File Name: Linuxcnc_P...28-2.ini
File Size:5.04 KB

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

Time to create page: 0.283 seconds
Powered by Kunena Forum