Hi all,

I think I may have found a bug when using homing with an index pulse in the
latest dev branch.  When homing an axis that uses an index pulse without a
home switch and a HOME_OFFSET that is not zero I was getting strange results
of the axis having the wrong coordinates after homing.

I tracked it down to the way the motor offset is calculated in the
src/emc/motion/homing.c file when the index pulse is detected.

I made the following fix on my system and it seems to work and not breaking
anything else, but I don't feel like I know enough about how the joints work
to say with great certainty that the fix is correct.  Can anyone comment on
whether the fix looks correct?  My interpretation of the existing code is
that it just sets the joint->motor_offset to -joint->home_offset without any
regard to the current joint->motor_pos_fb.  I believe this then causes
joint->pos_fb to be calculated incorrectly in the process_inputs function
inside src/emc/motion/control.c causing joint following errors and incorrect
joint->pos_fb values.  In my fixed code I try to set a value to
joint->motor_offset that will make future joint->pos_fb calculations
correct.

@@ -661,9 +661,8 @@ void do_homing(void)
                   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->motor_offset = joint->motor_pos_fb
-(joint->backlash_filt + joint->home_offset);
+               joint->pos_fb = joint->home_offset;
                joint->pos_cmd = joint->pos_fb;
                joint->free_pos_cmd = joint->pos_fb;
                /* next state */


Thanks!

Lawrence
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to