Temporarily Disable Signal to Servo Amp

More
3 years 9 months ago #261591 by hunterlong
Currently I have a custom.hal file that contains


# Load Classicladder
loadrt classicladder_rt
addf classicladder.0.refresh servo-thread
loadusr classicladder --nogui ladder.clp

# Tool change button
net tool-release-btn <= hm2_5i25.0.7i77.0.0.input-05
net tool-release-btn => classicladder.0.in-00
net tool-release-sig-drop classicladder.0.out-00 => hm2_5i25.0.7i77.0.0.output-00
net tool-release-sig-lock classicladder.0.out-01 => hm2_5i25.0.7i77.0.0.output-01
net tool-release-sig-push classicladder.0.out-02 => hm2_5i25.0.7i77.0.0.output-02


Can I just add to this custom.hal file?

loadrt and2
addf and2.0 servo-thread
net z-enable-joint and2.0.in0 <= joint.2.amp-enable-out
net z-enable-ladder and2.0.in1 <= classicladder.0.out-03
net z-enable <= and2.0.out0
net z-enable => pid.z.enable

I doubt that is right. I also attached my custom.hal, my_LinuxCNC_machine.hal, and my_LinuxCNC_machine.ini.

Thanks!
-Hunter

Please Log in to join the conversation.

More
3 years 9 months ago #261594 by hunterlong
I just found this really helpful hal tutorial:http://linuxcnc.org/docs/2.5/html/hal/basic_hal.html

In my my_LinuxCNC_machine.hal I already have this section
Code:
#******************* #  AXIS Z JOINT 2 #******************* setp   pid.z.Pgain     [JOINT_2]P setp   pid.z.Igain     [JOINT_2]I setp   pid.z.Dgain     [JOINT_2]D setp   pid.z.bias      [JOINT_2]BIAS setp   pid.z.FF0       [JOINT_2]FF0 setp   pid.z.FF1       [JOINT_2]FF1 setp   pid.z.FF2       [JOINT_2]FF2 setp   pid.z.deadband  [JOINT_2]DEADBAND setp   pid.z.maxoutput [JOINT_2]MAX_OUTPUT setp   pid.z.error-previous-target true net z-index-enable  <=> pid.z.index-enable net z-enable        =>  pid.z.enable net z-pos-cmd       =>  pid.z.command net z-pos-fb        =>  pid.z.feedback net z-output        <=  pid.z.output # ---PWM Generator signals/setup--- setp   hm2_5i25.0.7i77.0.1.analogout2-scalemax  [JOINT_2]OUTPUT_SCALE setp   hm2_5i25.0.7i77.0.1.analogout2-minlim    [JOINT_2]OUTPUT_MIN_LIMIT setp   hm2_5i25.0.7i77.0.1.analogout2-maxlim    [JOINT_2]OUTPUT_MAX_LIMIT net z-output     => hm2_5i25.0.7i77.0.1.analogout2 net z-pos-cmd    <= joint.2.motor-pos-cmd net z-enable     <= joint.2.amp-enable-out

So I will need to unlink the joint.2.amp-enable-out and the pid.z.enable pin from the z-enable net before I connect my and2 gate.

so
Code:
loadrt and2 addf and2.0 servo-thread unlinkp joint.2.amp-enable-out unlinkp pid.z.enable net z-enable-joint and2.0.in0 <= joint.2.amp-enable-out net z-enable-ladder and2.0.in1 <= classicladder.0.out-03 net z-enable <= and2.0.out0 net z-enable => pid.z.enable

-Hunter

Please Log in to join the conversation.

More
3 years 9 months ago #261596 by hunterlong
That worked! other than a few typos like and2.0.out0 is actually and2.0.out.

However, now as soon as I disable the PID with the pid.z.enable pin I get a following error in about 3 seconds.

Haven't tried while the z-axis was locked though. Maybe I won't get a following error.

EDIT: I can actually see the z-axis slowly drift down when I disable it, so no wonder I am getting a following error.
-Hunter

Please Log in to join the conversation.

More
3 years 9 months ago #261616 by hunterlong
It now works great! Thanks for all the help.

See the images and videos in this link (I added descriptions to each photo) for before/after: photos.app.goo.gl/A1DKWGkwW2Jyicae8

I can still get a following error if the z-axis is too high and travels down a bit before it hits the lock plate. Might try to fix this later, but as long as I get the z-axis height exactly right it works great. Tested like 10 times and no stuck lock plate, no servo driver faults!

-Hunter

Please Log in to join the conversation.

More
3 years 9 months ago #261619 by tommylight
You cam set the min_ferror to a bit higher value in the ini file to prevent joint error.

Please Log in to join the conversation.

More
3 years 9 months ago #261741 by Todd Zuercher

Yeah, you are exactly right. Right now I don't have any sensor to indicate that the lock plate is in position, I just fire the air solenoid and assume it is. There is a switch I could wire up that is activated when the plate locks.

Here is a video of the lockbar working, and me accidentally dropping my edge finder because I was videoing and not paying attention :)

photos.app.goo.gl/AH9BLkDeBQpQepMd8

-Hunter

Perhaps you are trying to make this entirely too complicated. You say there is/was a switch that was triggered when the lockplate is enguaged. I wouldn't be at all surprised if the original control simply ran the servo amp's enable signal through that switch. So that when the locking plate was engaged the amp was automatically disabled. You could either do the same (and leave Linuxcnc unaware) or bring that signal into hal to disable the PID with a piece of hal logic.

Please Log in to join the conversation.

More
3 years 9 months ago #261742 by hunterlong
You know that is a really good idea Todd. Why didn't I think of that!

However, it is working now pretty well so I will keep that in mind in case I start having trouble again!

-Hunter

Please Log in to join the conversation.

Time to create page: 0.161 seconds
Powered by Kunena Forum