Encoder Pins linked to LCNC

More
7 years 6 months ago #132220 by tommylight
Replied by tommylight on topic Encoder Pins linked to LCNC

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
7 years 5 months ago #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
7 years 5 months ago #133002 by andypugh
Replied by andypugh on topic Encoder Pins linked to LCNC

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
7 years 5 months ago - 7 years 5 months ago #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: 7 years 5 months ago by CORBETT. Reason: Added TXT files

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

More
7 years 5 months ago #133262 by andypugh
Replied by andypugh on topic Encoder Pins linked to LCNC
Code:
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
7 years 5 months ago #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.179 seconds
Powered by Kunena Forum