Encoder Pins linked to LCNC

More
28 Apr 2019 16:12 #132185 by PCW
Replied by PCW on topic Encoder Pins linked to LCNC
Slow drift on analog servos is normal and not terribly significant _except_ that it indicates a LinuxCNC setup issue:

The drives should not be enabled before LinuxCNC explicitly enables them

This is a machine/personnel safety issue for a couple or reasons:

1. Eventually you may drift into the machine stops and break something

2. LinuxCNC cannot disable the drives in case of a following error, for example from a broken encoder or bad analog signal, so a large class of potential runaways cannot be prevented

The effect of slow drift on tuning is not significant (it will cause a very small fixed position offset) , and can be adjusted with the PIDs bias pin

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

More
28 Apr 2019 21:52 #132198 by HueyHQ
Replied by HueyHQ on topic Encoder Pins linked to LCNC

PCW wrote: The drives should not be enabled before LinuxCNC explicitly enables them

No worries there, I have the drive-enable hooked up. (The only issue I have is when I forget to turn on the air to counter for the Z weight, and the Z drops a little as the brake releases slightly before the drive engages! :pinch: )

My concern is Tommy's comment that "they are supposed to drift slowly when no input is present" (I purposely did this to TUNE OUT the drift) - my servos are rock-solid with AND without input. (Altho' I expect this may vary with temperature?)

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

More
28 Apr 2019 23:19 #132201 by PCW
Replied by PCW on topic Encoder Pins linked to LCNC
I think "may be expected to drift slowly" is closer to the hardware behavior of analog drives ( Ideally they should not drift ), and yes its will often change a bit with temperature, after all a 1 RPM drift of a 2000 RPM servo motor is only 5 mV.

The static error created by a DC offset (assuming no I term and 10V analog scale ) is just the offset/P-Term so if you have a P term of 10 and a offset of 10mV, this would create
a 0.001" static offset
The following user(s) said Thank You: HueyHQ

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

More
29 Apr 2019 00:36 #132215 by HueyHQ
Replied by HueyHQ on topic Encoder Pins linked to LCNC
In my initial efforts to tune the servos (not terribly successfully, I might add!), is that if I add any value apart from P=1, my servos do weird things. I've yet to play with FF1, which I understand, is required for velocity drives? Oh, and I also need a little bit of deadband. But nothing else! But they don't drift.

Anyway, I've taken this way off-topic; I'll start a new post when I get to tuning! Thanks PCW.

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

More
29 Apr 2019 01:07 #132220 by tommylight

tommylight wrote: .....they are supposed to drift slowly when no input is present.

Forgot to add, when they are not connected to anything.
After connecting them to 7i77 i have never seen them drift, they just go back and forth form time to time at a 0.001mm or 0.01mm resolution. The only time i have one a Z axis drift was when it had the balancing weight removed while testing, and that was so slow that left for several hours it would barely make it to 1mm.

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

More
04 May 2019 23:03 #132785 by CORBETT
Replied by CORBETT on topic Encoder Pins linked to LCNC
Ok, I am getting closer now, or I believe I am. Was tied up with work and finally getting back to this.

I re-wrote the code and pretty sure I have most of the HAL file correct at this point. At first when I enabled the machine I was getting violent oscillations of the table (I unhooked Z input to focus on X & Y alone), then went and started tweaking the INI file. Specifically adjusting the P in PID part. I now have it to when you enable the machine it does not oscillate at all, but wants to keep drifting on Y but X will settle out and stop moving after a few seconds. In other words I can enable the machine, then jog the table in either direction/axis, but after moving X will still drift for a few seconds and settle down, but Y will keep drifting until it gets a joint motion error. I am sure that I am somewhat close and that some PID tuning plus fine tuning the scale will get closer. Also I need to check the DAC output voltage scaling to make sure it is correct.... when I was setting the system up, I had my voltmeter attached to the Beckhoff EL4132 outputs and was getting the correct voltage, but I need to double check and make sure I was correct on the scaling.

I just wanted to make sure I am on the correct path or what I believe to be the correct way. In other words I need to fine tune the encoder scale as I know it is off a touch on Z. Then tune the PID loop, and make sure the Beckhoff EL4132 output voltage is scaled correctly (DAC scale). Does this sound correct or am I misssing something that I need to implement?

Thanks,
Robert

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

More
06 May 2019 21:42 #133002 by andypugh

CORBETT wrote: In other words I need to fine tune the encoder scale as I know it is off a touch on Z.


It should be exact, and can be calculated from gear ratios.

But one source of a small error is the difference between a 5 TPI screw and a 5mm pitch screw.

My milling machine has both...

For some reason the GTEN RSW ballnuts (which are very slim for a 16mm screw, and very useful for a retrofit) are 16mm did and 5 TPI so actually 5.08 mm pitch. If you see a very slight error I would assume that this is your issue (possibly the other way)

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

More
09 May 2019 14:19 - 09 May 2019 14:27 #133241 by CORBETT
Replied by CORBETT on topic Encoder Pins linked to LCNC
Andy,

Yes, I will check the ball screw like you are stating as I know the Z ball screw had been changed out at some point. Plus it is the Z that was giving me problems, so that makes sense.

BUT, somewhere along the line I have screwed my HAL file up and I definitely do not have the loop closed. I pulled up HAL CONFIGURATION and was watching the enable, feedback, command, and output pins for the PID, AXIS, and the Beckhoff analog output. and you can see the feedback working, but nothing working on the command or output side of PID. I thought I had this figured out, but apparently I am missing something. When you enable the machine, the encoders start working because of the slow drift on each axis, but after a bit I get the joint motion error. Plus I can move the ball screw by hand and see that feedback works.

I am software encoding with the encoders hooked to a breakout board on the parport and everything else through EtherCAT. I went through several HAL files and looked at different setups, but still cannot figure out what I have wrong.

Any help will be most appreciated. Attached is my HAL and INI.

Thanks,
Robert

File Attachment:

File Name: hurco.txt
File Size:7 KB

File Attachment:

File Name: hurco-main.txt
File Size:7 KB

File Attachment:

File Name: hurco-motion.txt
File Size:3 KB

File Attachment:

File Name: hurco_2019-05-09.ini
File Size:7 KB

File Attachment:

File Name: hurco-motion.hal
File Size:3 KB
Attachments:
Last edit: 09 May 2019 14:27 by CORBETT. Reason: Added TXT files

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

More
09 May 2019 18:04 #133262 by andypugh
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hal_parport cfg="e010 in"
loadrt encoder num_chan=3
loadrt pid num_chan=3
loadrt pwmgen output_type=0

#################################################
# COMPONENT THREADS - MUST BE IN ORDER          #
######################################################################################################################################
# ADD FUNCTIONS TO REALTIME THREAD, DEFINE THE ORDER OF EXECUTION OF RT CODE
addf lcec.read-all              master
addf parport.0.read             master
addf encoder.update-counters    master
addf pwmgen.make-pulses         master
addf parport.0.write            master
addf lcec.write-all             master

addf encoder.capture-position   servo-thread
addf motion-command-handler 	servo-thread
addf motion-controller 		servo-thread
addf pid.0.do-pid-calcs 	servo-thread
addf pid.1.do-pid-calcs 	servo-thread
addf pid.2.do-pid-calcs 	servo-thread
addf pwmgen.update             	servo-thread

Do you actually have a realtime thread called "master" ? I don't see it in the "loadrt motmod" line.
The following user(s) said Thank You: CORBETT

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

More
09 May 2019 19:43 #133276 by CORBETT
Replied by CORBETT on topic Encoder Pins linked to LCNC
Yes I had it above the motmod line as it was what has been working with the ethercat driver. I had it as the following:

loadrt threads name1=master period1=50000
loadusr -W lcec_conf /home/robert/linuxcnc/configs/ethercat-conf.xml
loadrt lcec
loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES

I had it above the motmod line as I have always gotten it to work like this. I had tried to put it in the motmod line before and it failed, but that is probably my fault. Does it need to be written into the motmod line to work correctly? I assumed it either would work or not, and I had put it above the motmod line as it was the fastest thread.

Thanks,
Robert

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

Time to create page: 0.099 seconds
Powered by Kunena Forum