Reading non-trivial joint values

More
15 Mar 2015 15:34 #56831 by subtractive
I have non-trivial x-y axes, on a 3 axes machine.
j0 and j1 machine joints are displayed in Manual Control mode (M3).
When a log file is created after (LOGOPEN,filename.txt), is it possible to capture and write those j0 and j1 values. I’m probing the outside edge of a circular disc on the work table to calibrate the machine dimensions.

Subtractive

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

More
16 Apr 2015 18:01 #57834 by goatchurch
I'm working with Andy (Subtractive) on this problem.

We are probing an object whose dimensions are known (it's a disk made on a lathe), and we want to use the actual joint positions (as reported by the encoder when the probe makes contact) to help to calibrate the fixed constants that go in to our kinematicsInverse()/kinematicsForward() functions to drive our non-trivial kinematics machine.

Having looked in the source code where these functions are called in relation to a probing cycle, it seems that encoder (joint position) is read when the probe is tripped, and the kinematics function is called to convert these values to cartesian coordinates which are saved into the following object:

EmcPose emcmot_status_t::probedPos

See:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...4985043e8415368#l610

Unfortunately, since struct EmcPose contains only cartesian XYZ coordinates (as well as the 5-axis rotations ABC, which do not apply to our machine), these joint positions are not recorded and so cannot possibly be logged by the probing cycles without reprogramming the EmcPose class.

Does this sound right?

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

More
16 Apr 2015 19:18 #57837 by andypugh

said


"Goatchurch"? Are you a caver by any chance?

We are probing an object whose dimensions are known (it's a disk made on a lathe), and we want to use the actual joint positions (as reported by the encoder when the probe makes contact)


LOGOPEN and LOG only allow you to log values that are visible to G-code.

One way to do what you want might be to connect the axis.N.motor-pos-cmd HAL pins to G-Code "analogue inputs", read those into parameters in the G-code then (LOG, ...) them.

This has the problem that it logs the actual axis positions after the probe move has stopped, not the position at the instant that the probe tripped. How different the values are depends on probing speed.

If you need more accurate positions then in theory you could G0 to the probed position _then_ sample the HAL pin values. There is a risk there of triggering the probe during the G0, though, and that might abort the G-code (I can't remember if it does, it might just be a warning)

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

More
18 Apr 2015 18:26 #57879 by goatchurch
(Yep. Caver based in Liverpool, though I'm trying to do more hang-gliding this year, so far without much success.)

These external hardware hacks (as I read them) would be unnecessary if the EmcPose class simply had the joint values copied into it.

The class definition has three extra values (u,v,w) that don't seem to be of any use:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...24cdb4985043e8415368

Would it be an unreasonable hack to reuse these to transmit the joint positions back to the place where probing is done?


I'm not very familiar with actual machines (I've only done CAM software from a theoretical perspective), but it appears to me as a limitation of this probing feature if you don't get the joint values. If I am using probing of points to debug/improve the parameters of the kinematicsInverse() function, then it makes sense to have access to the raw input and output values of this function.

The idea is to automatically calibrate/check the machine on the day by probing a known object. Put this test piece on the table in the morning, let the machine poke/probe it about a bit, then it automatically sends a file of raw joint measurements through a python script (using scipy.optimize.minimize() on all the different over-constrained measurements), which spits out a new version of kinematicsInverse() on the day, compiles it and links it back in.

I've not been in a precision shop, but don't they go through some kind of process like this with their machines every day to keep them up to spec?

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

More
19 Apr 2015 20:48 #57892 by andypugh

These external hardware hacks (as I read them)


I am not talking about hardware. The G-Code "analogue inputs" only exist in the digital realm.
You can read the value of a HAL pin into G-code using M66.
www.linuxcnc.org/docs/html/gcode/m-code....ec:M66-Input-Control

The class definition has three extra values (u,v,w) that don't seem to be of any use:

UVW are extra axis values, though not often used. A typical use for W would be drill feed with a tilted head.

Would it be an unreasonable hack to reuse these to transmit the joint positions back to the place where probing is done?

If that gives you what you want, then it is Free software, you can do anything you want with it. But you will probably need to recompile.

Also have a look at www.linuxcnc.org/docs/html/man/man1/halsampler.1.html

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

More
27 Apr 2015 18:22 #58153 by goatchurch
Just as a follow up for completeness sake, the runes which we worked out were added to some kind of hal file were:
loadrt sampler depth=5000 cfg=fff
addf sampler.0 servo-thread
net j1 axis.0.joint-pos-cmd =>sampler.0.pin.0
net j2 axis.1.joint-pos-cmd =>sampler.0.pin.1
#net j3 axis.2.joint-pos-cmd =>sampler.0.pin.2

Then we needed to run halsampler outputsamplefile.txt

"depth" sets the buffer in terms of record length, but there's a second limit to the buffer size in bytes, so we were not able to uncomment the "net j3" line until we reduced the value of depth.

I can't right now remember the further "net" command we used for the contact pin, but when we put it in it was possible to see how far it over-shot. It seems to pull back further than the first point of contact before contact is broken, which is a mystery, because we don't know if this is due to backlash, or the motor position following behind its commands. It would be better if we could get the direct encoding of the rotors rather than the commands, but this info doesn't make it back into linuxcnc from the motor drivers, so this will have to do for now.

Thanks all for the help. I am beginning to get the underlying picture of the system, which seems pretty good so far -- however I wish that the realtime component could be broken out into a separate microcontroller that straightened out the pulses so they didn't need to be exact.

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

More
27 Apr 2015 18:42 #58154 by andypugh

however I wish that the realtime component could be broken out into a separate microcontroller that straightened out the pulses so they didn't need to be exact.


There are several bits of hardware that do exactly that (if I am correctly interpreting your wishes). Variants exist for PCI, Ethernet and EPP interfaces.

EPP:
www.pico-systems.com/PPMC.html
store.mesanet.com/index.php?route=produc...=83_85&product_id=67
store.mesanet.com/index.php?route=produc...83_85&product_id=291

PCI:
store.mesanet.com/index.php?route=produc...=83_85&product_id=55 (and several others, and PCIE)
www.generalmechatronics.com/en/linuxcnc

Ethernet:
store.mesanet.com/index.php?route=produc...83_86&product_id=290 (and alternatives)

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

Time to create page: 0.092 seconds
Powered by Kunena Forum