Re: Homing with servos
Hello Kurtis,
> If anyone can help, even off list - klmartineau-at-shaw.ca - I may have to
> offer a reward.
You catch cats with fish and mice .....
/* CHECK FOR LATCH CONDITION: */
/*
check for latch condition means if we're waiting for a
latched index pulse, and we see the pulse switch,
we read the raw input and abort. The offset is set
above in the homing section by noting that if we're homing,
and emcmotDebug->homingPhase[] is 3, we latched.
This presumes an encoder index pulse.
FIXME-- remove explicit calls to encoder index pulse, to
allow for open-loop control latching via switches only.
Open-loop control can be achieved, at least for STG boards, by
defining NO_INDEX_PULSE in extstgmot.c
*/
1 if (emcmotDebug->homingPhase[axis] == 3) {
2 /* read encoder index pulse */
3 extEncoderReadLatch(axis, &emcmotDebug->latchFlag[axis]);
4 if (emcmotDebug->latchFlag[axis]) {
5 /* code below is excuted once the index pulse is found */
6 /* call for an abort-- when it's finished, code
7 above sets inputOffset[] to emcmotDebug->saveLatch[] */
8 if (tpAbort(&emcmotDebug->freeAxis[axis]) == 0) {
9 /* Only advance the homing sequence if the motion is really aborted */
10 emcmotDebug->homingPhase[axis] = 4;
11 /* get latched position in RAW UNITS */
12 emcmotDebug->saveLatch[axis] = emcmotDebug->rawInput[axis];
13 }
14 } /* end of: if (emcmotDebug->latchFlag[axis]) */
15 } /* end of: if (emcmotDebug->homingPhase[axis] == 3 */
emc/src/emcmot/emcmot.h:
int homingPhase[EMCMOT_MAX_AXIS]; /*flags for homing */
This is the relevant code cut from emc/src/emcmot/emcmot.c.
Kurtis is sure that his index pulse is coming every revolution. So the above
code gets past at least the if statement at line L4, what can happen is that
the motion is not/never aborted for some reason I do not know at line L8 in
the if statement there.
I suggest you modify the above code to look like this for debugging purposes:
1 if (emcmotDebug->homingPhase[axis] == 3) {
diagnostics("homing: Phase %d, past L1\n", emcmotDebug->homingPhase[axis] );
2 /* read encoder index pulse */
/* translates to stgEncoderReadLatch for stg boards, always return 0, so no
need to check return value */
3 extEncoderReadLatch(axis, &emcmotDebug->latchFlag[axis]);
4 if (emcmotDebug->latchFlag[axis]) {
diagnostics("homing: Phase %d, past L4\n", emcmotDebug->homingPhase[axis] );
5 /* code below is excuted once the index pulse is found */
6 /* call for an abort-- when it's finished, code
7 above sets inputOffset[] to emcmotDebug->saveLatch[] */
8 if (tpAbort(&emcmotDebug->freeAxis[axis]) == 0) {
diagnostics("homing: Phase %d, past L8 trajectory planner aborted, good,
transition to homingPhase 4\n", emcmotDebug->homingPhase[axis] );
9 /* Only advance the homing sequence if the motion is really aborted */
10 emcmotDebug->homingPhase[axis] = 4;
11 /* get latched position in RAW UNITS */
12 emcmotDebug->saveLatch[axis] = emcmotDebug->rawInput[axis];
13 } else {
diagnostics("homing: Phase %d, trajectory planner failed to abort, bad\n",
emcmotDebug->homingPhase[axis] );
}
14 } /* end of: if (emcmotDebug->latchFlag[axis]) */
else {
diagonstics("homing: index pulse still not found, still searching\n");
}
15 } /* end of: if (emcmotDebug->homingPhase[axis] == 3 */
Of course please to not include the line numbers in the actually c-source ....
Then recompile, start the emc, check your console and see the diagonstics
output scroll on forever. If the first two and the last diags make to much
noise uncomment them out and recompile.
You might have to look through a lot of logs then because this loop is
running at the CYCLE_TIME of the axis.
If you see the output from:
diagnostics("homing: Phase %d, trajectory planner failed to abort, bad\n",
emcmotDebug->homingPhase[axis] );
you might have to introduce a new phase and insert this between the current
phase 3 and 4, do not forget to increment all other references to this
variable homingPhase then !
Hope this helps you Kurtis, I will be back reading my emails at the weekend
or next Wednesday, still more exams to come ;)
Regards
Max
--
Max Heise <max.heise-at-gmx.net>
Student Mechatronik/Automatisierungstechnik FHT Esslingen
PGP public key from:
http://www.fht-esslingen.de/~mahemt01/pgp50i.pub or any keyserver
Date Index |
Thread Index |
Back to archive index |
Back to Mailing List Page
Problems or questions? Contact