TCP 5-axis kinematics

More
7 years 4 months ago #137306 by Hakan
Replied by Hakan on topic TCP 5-axis kinematics
I am also interested in the current status.
Especially around the shifting of kinematics at arbitrary position.
Is that real now?

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

More
7 years 3 months ago - 6 years 10 months ago #139881 by plopes9000
Replied by plopes9000 on topic TCP 5-axis kinematics
I too have joined the club of getting TCP to work and be practical in LinuxCNC.

I have read this thread and looked at the code/configs of jsskangas and automata/r.lol.
In my view the switchkins approach is sound and its working.
jsskangas approach to include the rotary axis machine coordinates in the kinematics calculations is key to make it practical to use.

Since I wanted to get the latest dev branch, I actually retrofitted the switchkins branch changes into the 2.9pre dev branch.
Key topics:


1) change the switchKins kinematics to take into account the machine coordinates of the rotary axis - see switchKins.c attached.
Code:
net :tool-offset motion.tooloffset.z xyzac-trt-kins.tool-offset setp xyzac-trt-kins.y-offset -0.15 setp xyzac-trt-kins.z-offset -27.59 setp xyzac-trt-kins.x-rot-point 407.565 setp xyzac-trt-kins.y-rot-point 154.229 setp xyzac-trt-kins.z-rot-point -228.145


2) Improve my machine homing precision
This was not straight forward since my servo drive's connector and function to output the zero pulse are busy with the linuxcnc step/dir pulses and I certainly did not want to install additional encoders. I could use a different servo drive connector with 24V step/dir inputs but the frequency limit would go from 1MHz to 250KHz and I would need to fab a 5V differential (mesa 7i76) to 24V single ended circuit. Since I already use CanOpen over Ethercat for the servo drives and that gives me access to the motor rotary position - which is derived from the servo drive known absolute rotary position - I decided to write a small component to calculate the zero pulse.
Code:
net x-axis-zero-pulse-zero-pulse x.zero.pulse.zero-pulse <=> joint.0.index-enable net x-axis-zero-pulse-rot-pos x.zero.pulse.rotary-pos <= lcec.0.EL6751-CanOpen.x-rot-position
Code:
component axiszeropulserotposition "generate axis zero pulse from axis rotary position"; //--------------------------------------------------------------- pin io bit zero_pulse "generated rotary zero pulse"; pin in u32 rotary_pos "axis rotary position"; param rw u32 deadband=10000 "axis rotary position deadband"; variable u32 old_rot_pos=0; variable int old_dir=0; variable int pulse_started=0; //--------------------------------------------------------------- function _; license "GPL"; ;; FUNCTION(_) { u32 new_rot_pos = rotary_pos; if (new_rot_pos != old_rot_pos) { int new_dir=0; int over_deadband=0; if (new_rot_pos<old_rot_pos) { new_dir=-1; over_deadband=(old_rot_pos-new_rot_pos)>deadband; } else if (new_rot_pos>old_rot_pos) { new_dir=1; over_deadband=(new_rot_pos-old_rot_pos)>deadband; } if (over_deadband) { // skip 'deadband' size jumps in any direction if (zero_pulse && old_dir && new_dir && old_dir!=new_dir) zero_pulse = 0; if (new_dir) { // exclude same reading cases old_dir = new_dir; old_rot_pos = new_rot_pos; } } } }

However the LinuxCNC index homing procedure assumes that the sync is done with an encoder that resets its position and counters upon seeing the zero pulse. For that reason I had to change emc/motion/homing.c to keep using the offsets.
Code:
case HOME_SET_INDEX_POSITION: /* This state is called when the encoder has been reset at the index pulse position. It sets the current joint position to 'home_offset', which is the location of the index pulse in joint coordinates. */ /* set the current position to 'home_offset' */ joint->motor_offset = -joint->home_offset; joint->pos_fb = joint->motor_pos_fb - (joint->backlash_filt + joint->motor_offset); joint->pos_cmd = joint->pos_fb; joint->free_tp.curr_pos = joint->pos_fb; // PL ++ /* this moves the internal position but does not affect the motor position */ offset = joint->home_offset - joint->pos_fb; joint->pos_cmd += offset; joint->pos_fb += offset; joint->free_tp.curr_pos += offset; joint->motor_offset -= offset; // -- PL /* next state */ joint->home_state = HOME_FINAL_MOVE_START; immediate_state = 1; break;

Finally, see attached test gcode file and video.
Attachments:
Last edit: 6 years 10 months ago by plopes9000. Reason: updated component axiszeropulserotposition
The following user(s) said Thank You: jjdege

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

More
7 years 3 months ago #139886 by andypugh
Replied by andypugh on topic TCP 5-axis kinematics
Do you think this is generalisable? ie are there machine-specific constants compiled in to the kinematics? If it could be considered a generalisable kinematics then there might be an argument for building it in to LinuxCNC.

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

More
7 years 3 months ago #139887 by andypugh
Replied by andypugh on topic TCP 5-axis kinematics

plopes9000 wrote: Since I already use CanOpen over Ethercat for the servo drives and that gives me access to the motor rotary position - which is derived from the servo drive known absolute rotary position - I decided to write a small component to calculate the zero pulse


Are you aware that LinuxCNC now supports absolute encoders for homing?
linuxcnc.org/docs/2.8/html/config/ini-co...t__lt_num_gt_section
(HOME_ABSOLUTE_ENCODER)

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

More
7 years 3 months ago #139888 by dgarrett
Replied by dgarrett on topic TCP 5-axis kinematics
@plopes9000
Interesting work and excellent video!

Since you modified homing.c, I wonder if you could
help test an experimental branch: dgarr/homing_h

The purpose of this branch is to define a homing api
(applications interface) to make it easier for users to
create a custom homing.c for special applications (like
yours).

This branch is a candidate for a merge to the master
branch. I have tested numerous configs but have not
merged as i do not have the hardware needed to test
index homing.

The branch is rebased to the current master branch
(2.9~pre0) at commit baaf887f1 Jul 17.

To test with your application:
1) checkout the experimental branch
2) adapt the branch version of homing.c
'case HOME_SET_INDEX_POSITION'
statement as you did for the current master branch.

#
Commit message excerpt:
0) clarify interface with new homing.h
1) provide for initialization (homing_init())
2) localize per-joint homing-specific hal pins:
use: export_joint_home_pins() (one-time)
read_homing_in_pins() (servo-rate)
write_homing_out_pins() (servo-rate)
3) localize internal homing state machine (home_state_t)
'hiding' state variables from other motion components
4) use simple set_/get_ functions for overall and per-joint
queries and settings (instead of macros)
5) maintains use of existing logic and core routines:
do_homing_sequence()
do_homing()
6) use rtapi_bool.h
7) uses sequence states (home_sequence_state_t) per existing
design

No interface or functional changes are intended.

Ref: github.com/LinuxCNC/linuxcnc/commits/dgarr/homing_h

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

More
7 years 3 months ago #139889 by plopes9000
Replied by plopes9000 on topic TCP 5-axis kinematics
With regards to the changes to the switchkins kinematic module, which essentially combines the trivial and xyzac standard kins, there are no machine specific constants, its absolutely generic. and if the parameters for xyz rotation coordinates are provided with zero values, it behaves just like the standard trivial/xyzac kins.

With regards to the homing index changes, I think they should also should go in LinuxCNC, but it should be configurable ... something like a new setting HOME_INDEX_NO_ENCODER_RESET or similar. This would make the index homing sequence more generic.

Happy to work with one of you guys to get these changes in - would hate to have to re-patch every time I want to upgrade LinuxCNC.

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

Time to create page: 0.645 seconds
Powered by Kunena Forum