Passing C axis anglar positions into motion from hal component

More
05 Dec 2020 20:35 #191164 by CMB
I've created a hal component to calculate C axis angles from X,Y velocity to drive a tangential cutting blade.

After many many hours of searching I cannot seem to discover a suitable means of passing these angles into motion so the C axis can act on them as a wrapped rotary axis (the same as if the command were from gcode or mdi).

The hal component outputs angles from 0-359 as a signed value depending on the direction and would perhaps work fine if sent to motion outside of the trajectory planner. I use "motion" here as a generic term as I am unsure of what part applies the effect of tracking the axis position as a wrapped rotary axis. (can't seem to find the source code for this)

External offsets and extra joints both bypass the benefit of having C setup as a wrapped rotary axis and having the control keep track of position / offsets, etc.

Is there a simpler method or would I have to add position tracking and 0-359 roll-over to something like the limit3 comp and utilize extra joints? Can a Kinematics module accept an external position command for a stand alone axis?

Ps...I'm aware tangential axis control may be best done in G-code but I'm not yet ready to give up integrating it into the control itself :)

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

More
05 Dec 2020 23:41 #191182 by dgarrett

Can a Kinematics module accept an external position
command for a stand alone axis?


A kinematics module can read or write hal pins at the
servo-thread interval for its kinematics functions -- so you
could write a custom kinematics module to accept
inputs to modify the C axis value for the calculation of its
corresponding identity joint in the kinematicsInverse()
function.

The master branch (or recent 2.8.1) includes an example
kinematics module that can be built and installed with
halcompile and illustrates the creation of hal pins.

The template provided is a simple identity kins
(3joints 0,1,2==x,y,z) but extension to
(4joints 0,1,2,3==x,y,z,c) would be straightforward.

You must always be careful that the forward and inverse
kins are consistent but for your application, you may
be able to modify the joint3 value in the kinematicsInverse()
function according to an input from a hal pin read each cycle.

If your gcode uses the C axis, but you want to modify it in
the kinematics, it would require something like:
kinematicsInverse()
...
j[3] = pos->c + hal_pin_c_correction;  //add correction
                                       //for joint 3 motor

kinematicsForward()
...
pos->c = j[3] - hal_pin_c_correction; // remove correction
...

The ordering of addf's for your computation will be critical
to avoid following errors. It might be best to incorporate
your calculations in the kinematicsInverse() function. You
would need to save the calculated correction in a static
variable and apply its removal in the kinematicsForward()
calculation.

userkins man page:
linuxcnc.org/docs/2.8/html/man/man9/userkins.9.html

userkins template code:
github.com/LinuxCNC/linuxcnc/raw/2.8/src...onents/userkins.comp

halcompile man page:
linuxcnc.org/docs/2.8/html/man/man1/halcompile.1.html
The following user(s) said Thank You: CMB

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

More
06 Dec 2020 02:21 - 06 Dec 2020 02:23 #191203 by rodw
I have a pull request in progress (needs some revision) that extends the state tags functionality to publish more pins to motion. The main one I was interested in was the the arc radius. At the request of Andy, I added some additional pins to include the heading for use by people like you running a tangential knife.


Ref: github.com/LinuxCNC/linuxcnc/pull/900

The image shows the proposed pins.
It was envisaged the heading could be used command the knife axis.
Any help would be appreciated to finish this off,
Last edit: 06 Dec 2020 02:23 by rodw.
The following user(s) said Thank You: tommylight, CMB

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

More
07 Dec 2020 01:08 #191283 by CMB
Thanks dgarrett! I have a modified userkins example working similar to extra joints or external offsets but it didn't solve my problem.

Unless I can somehow pass these angles in to the interpreter so they are treated like mdi or gcode input, I suppose i better devise a plan to track axis position, commanded position and rollover in my hal component!

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

Time to create page: 0.322 seconds
Powered by Kunena Forum