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: 3 additions & 4 deletions configs/sim/axis/vismach/puma/mcodes/M128
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ emc_init -ini $::env(INI_FILE_NAME) -quick
package require Hal
parse_ini $::env(INI_FILE_NAME)

# RESTORE INI axis limits
# RESTORE INI axis velocity and acceleration limits (the position
# limits are never changed: a box on the machine frame, the flange)
foreach l $coords {
set L [string toupper $l]
catch {hal setp ini.$l.min_limit [set ::AXIS_[set L](MIN_LIMIT)]}
catch {hal setp ini.$l.max_limit [set ::AXIS_[set L](MAX_LIMIT)]}
catch {hal setp ini.$l.min_velocity [set ::AXIS_[set L](MAX_VELOCITY)]}
catch {hal setp ini.$l.max_velocity [set ::AXIS_[set L](MAX_VELOCITY)]}
catch {hal setp ini.$l.max_acceleration [set ::AXIS_[set L](MAX_ACCELERATION)]}
}

Expand Down
9 changes: 5 additions & 4 deletions configs/sim/axis/vismach/puma/mcodes/M129
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/tclsh
# switch kinematics and change axis limits to equiv joint limits
# switch kinematics and change axis velocity limits to equiv joint limits
set kinstype 1 ;# 1: IDENTITY kins
set switchkins_pin 3 ;# agree with inifile
set max_joints 6 ;# agree with inifile
Expand All @@ -10,11 +10,12 @@ emc_init -ini $::env(INI_FILE_NAME) -quick
package require Hal
parse_ini $::env(INI_FILE_NAME)

# SET axis limits for IDENTITY kins using INI joint limits
# SET axis velocity and acceleration limits for IDENTITY kins using
# INI joint limits. The position limits stay: they are a box on the
# machine frame, the flange, which motion reads through the arm
# kinematics whatever type is in force
for {set j 0} {$j < $max_joints} {incr j} {
set l [lindex $coords $j]
catch {hal setp ini.$l.min_limit [set ::JOINT_[set j](MIN_LIMIT)]}
catch {hal setp ini.$l.max_limit [set ::JOINT_[set j](MAX_LIMIT)]}
catch {hal setp ini.$l.max_velocity [set ::JOINT_[set j](MAX_VELOCITY)]}
catch {hal setp ini.$l.max_acceleration [set ::JOINT_[set j](MAX_ACCELERATION)]}
}
Expand Down
9 changes: 5 additions & 4 deletions configs/sim/axis/vismach/puma/mcodes/M130
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/tclsh
# switch kinematics and change axis limits
# switch kinematics and change axis velocity limits
set kinstype 2 ;# 2: TYPE 2 kins
set switchkins_pin 3 ;# agree with inifile
set max_joints 6 ;# agree with inifile
Expand All @@ -10,11 +10,12 @@ emc_init -ini $::env(INI_FILE_NAME) -quick
package require Hal
parse_ini $::env(INI_FILE_NAME)

# SET axis limits for IDENTITY kins using INI joint limits
# SET axis velocity and acceleration limits for IDENTITY kins using
# INI joint limits. The position limits stay: they are a box on the
# machine frame, the flange, which motion reads through the arm
# kinematics whatever type is in force
for {set j 0} {$j < $max_joints} {incr j} {
set l [lindex $coords $j]
catch {hal setp ini.$l.min_limit [set ::JOINT_[set j](MIN_LIMIT)]}
catch {hal setp ini.$l.max_limit [set ::JOINT_[set j](MAX_LIMIT)]}
catch {hal setp ini.$l.max_velocity [set ::JOINT_[set j](MAX_VELOCITY)]}
catch {hal setp ini.$l.max_acceleration [set ::JOINT_[set j](MAX_ACCELERATION)]}
}
Expand Down
2 changes: 1 addition & 1 deletion configs/sim/axis/vismach/puma/puma.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RS274NGC_STARTUP_CODE = G21 G10L2P0 x450 y100 z-495 a-180 (debug, ini: startup o
MDI_COMMAND = M428
MDI_COMMAND = M429
MDI_COMMAND = M430
# MDI-COMMANDS 03,04,05 ALTER limits when switching
# MDI-COMMANDS 03,04,05 ALTER velocity and acceleration limits when switching
MDI_COMMAND = M128
MDI_COMMAND = M129
MDI_COMMAND = M130
Expand Down
2 changes: 1 addition & 1 deletion configs/sim/axis/vismach/puma/puma560.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ PARAMETER_FILE = puma560.var
MDI_COMMAND = M428
MDI_COMMAND = M429
MDI_COMMAND = M430
# MDI-COMMANDS 03,04,05 ALTER limits when switching
# MDI-COMMANDS 03,04,05 ALTER velocity and acceleration limits when switching
MDI_COMMAND = M128
MDI_COMMAND = M129
MDI_COMMAND = M130
Expand Down
2 changes: 1 addition & 1 deletion configs/sim/axis/vismach/puma/puma560_uvw.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PARAMETER_FILE = puma560.var
MDI_COMMAND = M428
MDI_COMMAND = M429
MDI_COMMAND = M430
# MDI-COMMANDS 03,04,05 ALTER limits when switching
# MDI-COMMANDS 03,04,05 ALTER velocity and acceleration limits when switching
MDI_COMMAND = M128
MDI_COMMAND = M129
MDI_COMMAND = M130
Expand Down
2 changes: 1 addition & 1 deletion configs/sim/axis/vismach/puma/puma_cube.ini
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ POSTGUI_HALFILE = puma_postgui.hal
MDI_COMMAND = M428
MDI_COMMAND = M429
MDI_COMMAND = M430
# MDI-COMMANDS 03,04,05 ALTER limits when switching
# MDI-COMMANDS 03,04,05 ALTER velocity and acceleration limits when switching
MDI_COMMAND = M128
MDI_COMMAND = M129
MDI_COMMAND = M130
Expand Down
9 changes: 9 additions & 0 deletions docs/src/config/ini-config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,10 @@ The _<letter>_ specifies one of: X Y Z A B C U V W
The preview, the DROs, touch off and jogging of the GUIs follow the type too.
* `MAX_VELOCITY = 1.2` - (real) Maximum velocity for this axis in <<sub:ini:sec:traj,machine units>> per second.
* `MAX_ACCELERATION = 20.0` - (real) Maximum acceleration for this axis in machine units per second squared.
+
`MAX_VELOCITY` and `MAX_ACCELERATION` bound the letter in the world of the kinematics in force.
The joints are bound on their own: every move is capped at what its joints can follow within their `[JOINT_N]` limits, read through the kinematics module's Jacobian along the move, and a world jog the same way every servo cycle, so on a kinematics that is not the identity a move or a jog runs at the pace of its slowest joint whatever these say.
See the <<cha:switchable-kinematics,Switchable Kinematics>> chapter, INI file limit settings.
* `MAX_JERK = 0.0` - (real) Maximum jerk for this axis in machine units per second cubed.
Used when S-curve trajectory planning is enabled.
When set to 0 (default), no per-axis jerk limiting is applied.
Expand All @@ -1051,6 +1055,11 @@ The _<letter>_ specifies one of: X Y Z A B C U V W
When this limit is exceeded, the controller aborts axis motion.
The axis must be homed before MAX_LIMIT is in force.
For a rotary axis (A,B,C typ) with unlimited rotation having no `MAX_LIMIT` for that axis in the `[AXIS_`<letter>`]` section a value of 1e99 is used.
+
`MIN_LIMIT` and `MAX_LIMIT` together are a box in the machine frame: the carriage, or the flange of a robot, in machine coordinates, the frame that does not move when a head tilts or a tool is loaded.
On a kinematics module that declares its machine frame type (see the <<cha:switchable-kinematics,Switchable Kinematics>> chapter) every move is checked against the box where its joints put the machine frame, whatever kinematics type is in force: a tool centre point move whose tip lies past the box with the carriage inside it is accepted, and a 'G53.5' to a carriage position past the box is refused.
The travel itself is the `[JOINT_N]` limits; the box is a restriction the configuration adds inside it.
A module with one kinematics type whose joints are its slides, maxkins, reads the box on its joints, each in its letter. A module that declares no machine frame type and whose joints are not its slides keeps the box on the world of the kinematics in force.
* `WRAPPED_ROTARY = 1` - (bool) When this is set to 1 for an ANGULAR axis the axis will move 0-359.999 degrees.
Positive Numbers will move the axis in a positive direction and negative numbers will move the axis in the negative direction.
It is ignored on a `LINEAR` axis.
Expand Down
12 changes: 12 additions & 0 deletions docs/src/gcode.html.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ tr.head td, tr.head th { background: black; color: white; }
<tr><td><a href="gcode/g-code.html#gcode:g33">G33</a></td><td>K ($)</td><td>Spindle Synchronized Motion</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g33.1">G33.1</a></td><td>K ($)</td><td>Rigid Tapping</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g80">G80</a> </td><td/><td>Cancel Canned Cycle</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g53.4">G53.4</a></td><td/><td>Point-to-Point Move, Program Coordinates</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g53.4">G53.5</a></td><td/><td>Point-to-Point Move, Machine Frame</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g53.4">G53.7</a></td><td>J&lt;n&gt;=</td><td>Point-to-Point Move, Joint Values</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g53.1">G53.1, G53.3, G53.6</a></td><td>(P) (Q)</td><td>Orient the Tool to the Work Plane</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g53.1">G53.2</a></td><td>(P) (Q)</td><td>Solve the Tool Orientation, No Motion</td></tr>

<tr><th>Canned cycles</th><td colspan="2">(X Y Z or U V W apply to canned cycles, depending on active plane)</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g70">G70</a></td><td>Q (X) (Z) (D) (E) (P)</td><td>Lathe finishing cycle</td></tr>
Expand Down Expand Up @@ -100,6 +105,8 @@ tr.head td, tr.head th { background: black; color: white; }
<tr><td><a href="gcode/g-code.html#gcode:g43">G43</a> </td><td> H </td><td>Tool Length Offset</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g43.1">G43.1</a> </td><td> </td><td>Dynamic Tool Length Offset</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g43.2">G43.2</a> </td><td> H </td><td>Apply additional Tool Length Offset</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g43.4">G43.4</a> </td><td> (H) </td><td>Tool Length Offset on Primary Kinematics</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g43.5">G43.5</a> </td><td> (H) </td><td>Tool Length Offset, Tool Axis as a Vector</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g49">G49</a> </td><td> </td><td>Cancel Tool Length Compensation</td></tr>

<tr><th colspan="3">Stopping </th></tr>
Expand Down Expand Up @@ -136,6 +143,10 @@ tr.head td, tr.head th { background: black; color: white; }
<tr><td><a href="gcode/m-code.html#mcode:m52">M52</a></td><td>P0 (off) or P1 (on)</td><td>Adaptive Feed Control</td></tr>
<tr><td><a href="gcode/m-code.html#mcode:m53">M53</a></td><td>P0 (off) or P1 (on)</td><td>Feed Stop Control</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g54-g59.3">G54-G59.3</a></td><td/><td>Select Coordinate System</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g68.2">G68.2, G68.4</a></td><td>P Q I J K R</td><td>Tilted Work Plane</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g68.2">G68.3</a></td><td>(R)</td><td>Tilted Work Plane from the Tool</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g68.2">G69</a></td><td/><td>Cancel Tilted Work Plane</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g12.1-g13.1">G12.1, G13.1</a></td><td>P</td><td>Select Kinematics</td></tr>

<tr><th colspan="3">Flow-control Codes </th></tr>
<tr><td><a href="gcode/o-code.html#ocode:subroutines">o sub</a></td><td/><td>Subroutines, sub/endsub call</td></tr>
Expand Down Expand Up @@ -167,6 +178,7 @@ tr.head td, tr.head th { background: black; color: white; }
<tr><td><a href="gcode/g-code.html#gcode:g28-g28.1">G28, G28.1</a></td><td/><td>Go/Set Predefined Position</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g28.2">G28.2</a></td><td>P</td><td>Home from G-code</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g30-g30.1">G30, G30.1</a></td><td/><td>Go/Set Predefined Position</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g28.5">G28.5, G30.5</a></td><td/><td>Go to Predefined Machine Frame Position</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g53">G53</a></td><td/><td>Move in Machine Coordinates</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g92">G52, G92</a></td><td/><td>Coordinate System Offset</td></tr>
<tr><td><a href="gcode/g-code.html#gcode:g92.1-g92.2">G92.1, G92.2</a></td><td/><td>Reset G92 Offsets</td></tr>
Expand Down
10 changes: 5 additions & 5 deletions docs/src/gcode/g-code.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ as the 'L number', and so on for any other letter.
|<<gcode:g17-g19.1,G17 - G19.1>> |Plane Select
|<<gcode:g20-g21,G20 G21>> |Set Units of Measure
|<<gcode:g28-g28.1,G28 - G28.1>> |Go to Predefined Position
|<<gcode:g28.5,G28.5 G30.5>> |Go to Predefined Slide Position
|<<gcode:g28.5,G28.5 G30.5>> |Go to Predefined Machine Frame Position
|<<gcode:g28.2,G28.2>> |Home from G-code
|<<gcode:g30-g30.1,G30 - G30.1>> |Go to Predefined Position
|<<gcode:g33,G33>> |Spindle Synchronized Motion
Expand Down Expand Up @@ -1199,16 +1199,16 @@ G30 Z2.5 (rapid to Z2.5 then to the Z location specified in #5183)

The 'absolute' position is the machine coordinate system of the kinematics in
force, see <<gcode:g53,G53>>; <<gcode:g28.5,G30.5>> is the form that moves
the slides, and with `MACHINE_MOVES_IN_MACHINE_FRAME` set 'G30' and 'G30.1' are
'G30.5' and its store whenever the kinematics in force is not the machine frame
kinematics.
in the machine frame, and with `MACHINE_MOVES_IN_MACHINE_FRAME` set 'G30' and
'G30.1' are 'G30.5' and its store whenever the kinematics in force is not the
machine frame kinematics.

It is an error if :

* Cutter Compensation is turned on

[[gcode:g28.5]]
== G28.5, G30.5 Go to Predefined Slide Position(((G28.5 Go to Predefined Slide Position)))
== G28.5, G30.5 Go to Predefined Machine Frame Position(((G28.5 Go to Predefined Machine Frame Position)))

[source,ngc]
----
Expand Down
4 changes: 3 additions & 1 deletion docs/src/motion/kinematics-conventions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,9 @@ names. Its tool is the caller's where the caller gives one through
`kinematicsUserSetTool()`, since a planner knows what a segment runs under
better than the machine does; otherwise it is motion's, from motion's own
offset pins, and the loader says once when the module's tool pin disagrees with
them. `kinslimits` is built on it.
them. `kinslimits` is built on it, and so is the cap canon puts on every
segment's velocity and acceleration from the joint limits through the Jacobian
(see the Switchable Kinematics chapter, INI file limit settings).

A module that does not provide the form keeps working as it did. It just cannot
be evaluated outside realtime, which the loader reports.
Expand Down
67 changes: 52 additions & 15 deletions docs/src/motion/switchkins.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,48 @@ MAX_VELOCITY =
MIN_ACCELERATION =
----

The INI file limits specified apply to the type 0 default
kinematics type that is activated at startup. These limits may
*not* be applicable when switching to alternative kinematics.
However, since an interpreter-motion synchronization is required
when switching kinematics, INI-HAL pins can be used to setup
limits for a pending kinematics type.
The position limits, `MIN_LIMIT` and `MAX_LIMIT`, are a box in the
machine frame, the world of the kinstype the module declares
KINSTYPE_MACHINE (its identity kinstype where it declares none):
the carriage in machine coordinates, or a robot's flange in its base
frame. Every move is checked against that box where its joints put
the machine frame, whichever kinstype is in force, so the box means
the same thing after a switch as before it and needs no resetting.
The travel is the `[JOINT_N]` limits, checked on every move as well;
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 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:
every segment is sampled through the module's Jacobian ahead of
motion, on the kinstype and the tool offset the program is under, and
its velocity and acceleration are lowered to what the slowest joint
can give within its own `[JOINT_N]` limits, the share a carriage on a
circle feels as centripetal included. A turn of a tilted head under
the tool centre point, which swings the carriage through a circle the
head's own limit never mentions, runs at the carriage's pace. A
module that can only be evaluated in realtime (one without the
parameter block form, see <<sec:switchkins-code-notes,Code Notes>>)
caps nothing; on it the `[AXIS_L]` limits are all there is. A world
jog is bounded the same way, in motion, every servo cycle: the Jacobian
at the joints the machine stands in caps the jog's planners so that no
joint is asked for more than its limits, and a jog of C under the tool
centre point with the head laid over runs at the pace of the carriage
it swings. The cap reads the joints' travel too: where the carriage
would run onto its `[JOINT_N]` soft limit the jog slows and comes to rest
against it, as a jog of a slide does at its axis limit, with no error,
and a jog the other way moves off it.

So a switch does not need the velocity and acceleration limits reset
to keep the joints within their limits. It may still want them reset
where a letter names a joint of another kind after the switch: a
robot's identity kinstype puts joint 0, a rotary, on X, and the
`[AXIS_X]` limit in mm/s says nothing useful about it. Since an
interpreter-motion synchronization is required when switching
kinematics, INI-HAL pins can be used to set up limits for a pending
kinematics type.

[NOTE]
INI-HAL pins are typically not recognized during a G-code program
Expand Down Expand Up @@ -340,7 +376,7 @@ kinematics (trivkins).
See the kins man page for more information ($ man kins).

A user-provided M-code can alter any or all of the axis coordinate
limits prior to changing the motion.switchkins-type pin and
velocity and acceleration limits prior to changing the motion.switchkins-type pin and
synchronizing the interpreter and motionparts of LinuxCNC. As an
example, a bash script invoking halcmd can be 'hardcoded' to set
any number of HAL pins:
Expand All @@ -366,24 +402,25 @@ with a complex (non-identity) kinematics (type0) after homing.
The system is configured so that it can be switched to identity
kinematics (type1) in order to manipulate individual joints using
the conventional letters from the set 'XYZABCUVW'. The INI file
settings ([AXIS_L]) are *not* applicable when operating with
identity (type1) kinematics. To address this use case, the user
M-code scripts can be designed as follows:
velocity and acceleration settings ([AXIS_L]) are *not* applicable
when operating with identity (type1) kinematics. To address this
use case, the user M-code scripts can be designed as follows:

*M129* (Switch to identity type1)

. read and parse INI file
. HAL: setp the INI-HAL limit pins for each axis letter ([AXIS_L])
according to the 'identity-referenced' joint number INI file
setting ([JOINT_N])
. HAL: setp the INI-HAL velocity and acceleration pins for each axis
letter ([AXIS_L]) according to the 'identity-referenced' joint
number INI file setting ([JOINT_N])
. HAL: `setp motion.switchkins-type 1`
. MDI: execute a syncing G-code (M66E0L0)

*M128* (restore robot default kinematics type 0)

. read and parse INI file
. HAL: setp the INI-HAL limit pins for each axis letter ([AXIS_L])
according to the appropriate INI file setting ([AXIS_L])
. HAL: setp the INI-HAL velocity and acceleration pins for each axis
letter ([AXIS_L]) according to the appropriate INI file setting
([AXIS_L])
. HAL: `setp motion.switchkins-type 0`
. MDI: execute a syncing G-code (M66E0L0)

Expand Down
Loading
Loading