Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/src/config/ini-config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1204,9 +1204,10 @@ These settings are verified at startup when the trivkins kinematics modules is s
The `[JOINT_N]MIN_LIMIT`/`MAX_LIMIT` settings are enforced while jogging in joint mode prior to homing.
After homing, `[AXIS_L]MIN_LIMIT`/`MAX_LIMIT` coordinate limits are used as constraints for axis (coordinate letter) jogging
and by the trajectory planning used for G-code moves (programs and MDI commands).
The trajectory planner works in Cartesian space (XYZABCUVW) and has no information about the motion of joints implemented by *any* kinematics module.
It is possible for joint limit violations to occur for G-code that obeys trajectory planning position limits when non identity kinematics are used.
The motion module always detects joint position limit violations and faults if they occur during the execution of G-code commands.
The trajectory planner works in Cartesian space (XYZABCUVW).
On a kinematics that is not the identity, every move of a program or an MDI command is also followed through the kinematics module ahead of motion, and a move that would take a joint past `MIN_LIMIT` or `MAX_LIMIT` anywhere along it is refused before it runs, its line failing with the joint and the limit; see the <<cha:switchable-kinematics,Switchable Kinematics>> chapter, INI file limit settings.
A kinematics module that can only be evaluated in realtime is checked at the ends of each move.
The motion module detects a joint position limit violation during the execution of G-code commands and faults, for what cannot be seen ahead of it.
See also related https://github.com/LinuxCNC/linuxcnc/issues/97[GitHub issue #97].
====

Expand Down
8 changes: 5 additions & 3 deletions docs/src/motion/kinematics-conventions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,11 @@ every block. It is the inverse of the tool frame: not where the tool points
for these joints, but which joints point it there.

It has more than one answer. A five-axis machine reaches a given tool axis two
ways, one with the secondary rotary positive and one with it negative, and
which of the two is wanted depends on the joint limits and on what the operator
asked for, shortest move or one direction of rotation only. So the module
ways, which differ in the sign of the first rotary met going from the tool to
the work: the secondary rotary of two in the head, the one carrying the other
of two in the table, the head rotary of one of each. Which of the two is wanted
depends on the joint limits and on what the operator asked for, shortest move
or one direction of rotation only. So the module
reports every set of joint values that reaches the orientation and stops there.
It does not apply the joint limits and it does not rank the answers, because
neither is geometry: a module that picked for the caller would be picking with
Expand Down
15 changes: 15 additions & 0 deletions docs/src/motion/switchkins.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,21 @@ the box is a restriction inside it. A module that declares no
kinstype flags keeps the box on the world of the kinstype in force,
as before.

The travel is followed along each move, not only at its end. Ahead
of motion every segment is sampled through the module, on the
kinstype and the tool offset the program is under, and a move that
would take a homed joint past its `MIN_LIMIT` or `MAX_LIMIT` anywhere
along it is refused before it is sent: a turn of a tilted head under
the tool centre point that swings the carriage past its travel and
back, with both ends of the move inside it, fails its line with the
joint, the limit and where along the move it would be passed, and
nothing of it runs. Between samples the joint is followed on the
cubic through their positions and rates, and a peak that comes near
the limit is read through the module itself; only a point the module
puts past the limit refuses a move. A module that can only be
evaluated in realtime is checked at the ends of each move; motion's
own check of the joints while they move stays behind both.

The velocity and acceleration limits, `MAX_VELOCITY` and
`MAX_ACCELERATION`, bound the coordinate letter in the world of the
kinstype in force. What the joints can follow is bound separately:
Expand Down
6 changes: 6 additions & 0 deletions include/nml_intf/canon.hh
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ extern void CANON_UPDATE_END_POINT(double x, double y, double z,
/* Called from emctask to update the canon position during skipping through
programs started with start-from-line > 0. */

extern int CANON_MOVE_REFUSED(char *message, size_t messagesize);
/* Called from emctask after the interpreter has read or executed a line:
1 and the reason in message where canon refused a move since the last
call, because a joint would leave its travel along it, 0 otherwise.
The refused move and every move after it are dropped until then. */

extern void USE_LENGTH_UNITS(CANON_UNITS u);

/* Use the specified units for length. Conceptually, the units must
Expand Down
19 changes: 16 additions & 3 deletions src/emc/motion_planning/kinslimits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ static void usage(const char *argv0)
"usage: %s --module NAME --joints N --coords LETTERS\n"
" --start x,y,z,a,b,c,u,v,w --end x,y,z,a,b,c,u,v,w\n"
" --vel v0,v1,... --acc a0,a1,... [--jerk j0,j1,...]\n"
" [--min m0,m1,... --max m0,m1,...]\n"
" [--samples N] [--singularity COND]\n"
"\n"
"Prints the Jacobian and the world-space caps the joint limits imply\n"
"for a straight move from --start to --end. Requires a running HAL\n"
"instance with the kinematics module loaded.\n", argv0);
"for a straight move from --start to --end, and with --min and --max\n"
"the first place along it a joint leaves its travel. Requires a\n"
"running HAL instance with the kinematics module loaded.\n", argv0);
}

int main(int argc, char **argv)
Expand All @@ -106,7 +108,7 @@ int main(int argc, char **argv)
int num_joints = 0;
int samples = 11;
double singularity = 100.0;
std::vector<double> start_v, end_v, vel_v, acc_v, jerk_v;
std::vector<double> start_v, end_v, vel_v, acc_v, jerk_v, min_v, max_v;

for (int i = 1; i < argc; i++) {
const char *a = argv[i];
Expand All @@ -121,6 +123,8 @@ int main(int argc, char **argv)
else if (!strcmp(a, "--vel") && next) { vel_v = parse_list(next); i++; }
else if (!strcmp(a, "--acc") && next) { acc_v = parse_list(next); i++; }
else if (!strcmp(a, "--jerk") && next) { jerk_v = parse_list(next); i++; }
else if (!strcmp(a, "--min") && next) { min_v = parse_list(next); i++; }
else if (!strcmp(a, "--max") && next) { max_v = parse_list(next); i++; }
else { usage(argv[0]); return 1; }
}

Expand Down Expand Up @@ -275,6 +279,8 @@ int main(int argc, char **argv)
for (int j = 0; j < KINEMATICS_USER_MAX_JOINTS; j++) {
lim.vel[j] = j < num_joints ? vel_v[j] : SEGMENT_CAP_NONE;
lim.acc[j] = j < num_joints ? acc_v[j] : SEGMENT_CAP_NONE;
lim.min[j] = j < (int)min_v.size() ? min_v[j] : -HUGE_VAL;
lim.max[j] = j < (int)max_v.size() ? max_v[j] : HUGE_VAL;
}
auto pose_at = [](double f, EmcPose *p, void *arg) {
const EmcPose *se = (const EmcPose *)arg;
Expand All @@ -285,6 +291,13 @@ int main(int argc, char **argv)
if (segmentCap(ctx, &lim, target, samples, pose_at, &line, joints, &cap) == 0) {
printf("canon's cap : vel %.3f (joint %d at s=%.3f), acc %.1f (joint %d), %d of %d samples unanswered\n",
cap.vel, cap.vel_joint, cap.vel_at, cap.acc, cap.acc_joint, cap.unanswered, cap.samples);
if (cap.travel_joint >= 0) {
printf("travel : joint %d past its %s at s=%.3f, at %.6f\n",
cap.travel_joint, cap.travel_side > 0 ? "MAX_LIMIT" : "MIN_LIMIT",
cap.travel_at, cap.travel_pos);
} else if (!min_v.empty() || !max_v.empty()) {
printf("travel : every joint inside it\n");
}
} else {
printf("canon's cap : none, no sample could be evaluated\n");
}
Expand Down
Loading