Skip to main content

engine.solvers.trajectory

engine.solvers.trajectory

Trajectory-planning solvers: joint rates, handoff deadlines, seams, swings, and jerk-limited stops.

Domain implementations behind mlsysim.solvers (the public import path, derived from engine.solvers.__init__). The equations live in physics.robotics (the two-link Jacobian and damped least squares, the S-curve and polynomial stops, the seam torque step, the spill bound); these models compose them for one stated arm, joint, base, or mission, so a chapter, a slide deck, and a lab read the same arithmetic (added 2026-10-20).

Classes

Name Description
BrakingBlendModel A bumpless transfer from cruise into braking, beside the step and the resident stop.
ChunkReplacementModel Replacement latency, capture to admission, against the renewal period and the lease.
DynamicWindowModel The dynamic window of a base over one renewal, and the classical admissibility test.
HandoffExposureModel A per-handoff deadline budget read across a mission of K handoffs.
JerkLimitedStopModel A delayed jerk-limited (S-curve) stop, beside the constant and polynomial stops it replaces.
SeamBridgeModel A velocity gap at a chunk seam, closed in one servo tick or by a quintic bridge.
ShoulderSwingModel The loaded shoulder: holding torque, effective inertia, and a rest-to-rest swing.
SpillLimitedStopModel The stop of a machine carrying an open container, whose liquid caps the deceleration.
StaleAnchorModel How far a moving reference runs past a pose sampled when a replacement was requested.
TrajectoryDeadlinesModel The deadlines a trajectory record carries, and the cruise charged before its stop begins.
TwoLinkJointRateModel Joint rates a tool speed asks of a planar two-link arm, exact and damped.

BrakingBlendModel

engine.solvers.trajectory.BrakingBlendModel()

A bumpless transfer from cruise into braking, beside the step and the resident stop.

At a change of authority the enforcer may blend the base’s command from cruise to the braking deceleration a with the fixed-endpoint quintic smoothstep. Its slope peaks at 1.875, so under the resident stop’s jerk bound j the window is T = 1.875 a / j (calc_smoothstep_blend_window), rounded up to whole permission ticks. The same change taken in one tick asks a jerk of a / tick. During the blend the speed falls by a T / 2 and the base travels v0 T - a T^2 / 7 (calc_smoothstep_braking_blend); full braking follows. The blended stop is set against an ideal step (v0^2 / 2a) and the resident S-curve stop; the reserve a blend uses is the largest growth of travel plus resident stop over its ticks (calc_blend_reserve_use). An arm joint’s torque change under a torque-rate ceiling gives its own window the same way (added 2026-10-20).

Methods

Name Description
solve Account for travel and reserve consumed while blending into braking.
solve
engine.solvers.trajectory.BrakingBlendModel.solve(
    speed,
    deceleration,
    jerk,
    tick,
    torque_change=None,
    torque_rate_limit=None,
)

Account for travel and reserve consumed while blending into braking.

Parameters
Name Type Description Default
speed Quantity Positive initial cruise speed, in meters per second; sufficient to remain nonnegative over the blend. required
deceleration Quantity Positive final braking-acceleration magnitude, in meters per second squared. required
jerk Quantity Positive permitted jerk magnitude, in meters per second cubed. required
tick Quantity Positive permission/control tick used to round budgets and sample reserve use. required
torque_change Quantity Optional positive arm torque change; used only together with torque_rate_limit. None
torque_rate_limit Quantity Optional positive arm torque slew limit; used only together with torque_change. None
Returns
Name Type Description
BrakingBlendResult Blend window and rounded budget, travel distances and reserve use in length units, and optional arm blend timing. The actual blend uses the unrounded window; tick rounding supplies its budget.
See Also

mlsysim.physics.robotics.actuation.calc_smoothstep_blend_window : Scale the smoothstep derivative to a rate ceiling. mlsysim.physics.robotics.stopping.calc_smoothstep_braking_blend : Integrate speed and travel while acceleration is blended.

Notes

Equation: T = 1.875*deceleration/jerk, exit speed = speed-deceleration*T/2, and blend travel = speed*T-deceleration*T**2/7. Constant braking follows the blend.

Assumptions: A fixed-endpoint quintic smoothstep reaches the requested deceleration without reversal. Reserve use is sampled at permission ticks.

Excludes: Actuator lag, changing traction, obstacles, continuous-time reserve maximization, and a safety guarantee.

References

Derivation: The quintic smoothstep has maximum normalized slope 1.875. Scaling its slope by acceleration change and dividing by the jerk ceiling gives the shortest modeled window; integrating gives speed and travel.

Examples
>>> from mlsysim.solvers import BrakingBlendModel
>>> from mlsysim import Q_
>>> result = BrakingBlendModel().solve(
...     speed=Q_('2 m/s'),
...     deceleration=Q_('1 m/s^2'),
...     jerk=Q_('10 m/s^3'),
...     tick=Q_('1 ms'),
... )
>>> result.blended_stop > result.step_stop
True

ChunkReplacementModel

engine.solvers.trajectory.ChunkReplacementModel()

Replacement latency, capture to admission, against the renewal period and the lease.

L = observation age at dispatch + the dispatch-to-admission allocation; the inference pass and whole-plan validation sit inside the allocation. Admitting one plan every renewal period with L longer than that period keeps ceil(L / T_renew) requests in flight.

Methods

Name Description
solve Account for replacement latency and concurrent renewal requests.
solve
engine.solvers.trajectory.ChunkReplacementModel.solve(
    observation_age,
    dispatch_to_admission,
    inference,
    validation,
    renewal_period,
    lease,
    interference_tail,
)

Account for replacement latency and concurrent renewal requests.

Parameters
Name Type Description Default
observation_age Quantity Nonnegative age of evidence at dispatch, in time units. required
dispatch_to_admission Quantity Nonnegative total allocation from dispatch to admission, in time units. required
inference Quantity Positive inference duration within the dispatch allocation; used as a comparison denominator. required
validation Quantity Nonnegative validation duration within the dispatch allocation. required
renewal_period Quantity Positive interval between replacement requests. required
lease Quantity Nonnegative duration for which an admitted chunk remains authorized. required
interference_tail Quantity Nonnegative interference-tail duration to compare with inference. required
Returns
Name Type Description
ChunkReplacementResult Latency, unassigned-stage time and lease overrun in milliseconds; latency ratios and the ceiling of concurrent requests. Negative residual time exposes an inconsistent allocation.
Notes

Equation: L = observation_age + dispatch_to_admission; requests_in_flight = ceil(L/renewal_period). Other stages equal the allocation minus inference and validation.

Assumptions: Requests arrive periodically and experience the stated fixed capture-to-admission latency.

Excludes: Queue dynamics, probabilistic interference, admission rejection, and validation of the supplied timing allocation.

References

Derivation: Add serial stage durations; during a latency interval L, a periodic requester can have ceil(L/T) requests outstanding.

Examples
>>> from mlsysim.solvers import ChunkReplacementModel
>>> from mlsysim import Q_
>>> result = ChunkReplacementModel().solve(
...     observation_age=Q_('5 ms'),
...     dispatch_to_admission=Q_('15 ms'),
...     inference=Q_('10 ms'),
...     validation=Q_('2 ms'),
...     renewal_period=Q_('10 ms'),
...     lease=Q_('30 ms'),
...     interference_tail=Q_('3 ms'),
... )
>>> result.requests_in_flight
2

DynamicWindowModel

engine.solvers.trajectory.DynamicWindowModel()

The dynamic window of a base over one renewal, and the classical admissibility test.

Speeds reachable in the next window differ from the current one by at most a_max x window. The dynamic window approach admits an arc whose speed satisfies v <= sqrt(2 d a_b), a constant-deceleration stop within the distance d to the nearest obstacle (Fox, Burgard, and Thrun 1997, eq. 14), with no pre-brake delay, jerk ramps, or margins.

Methods

Name Description
solve Compare reachable speed change with a constant-deceleration stop ceiling.
solve
engine.solvers.trajectory.DynamicWindowModel.solve(
    max_acceleration,
    window,
    clear_distance,
    deceleration,
    drive_limit,
)

Compare reachable speed change with a constant-deceleration stop ceiling.

Parameters
Name Type Description Default
max_acceleration Quantity Nonnegative acceleration magnitude, in meters per second squared. required
window Quantity Nonnegative duration over which reachable speed change is evaluated. required
clear_distance Quantity Nonnegative distance to the obstacle along the candidate arc. required
deceleration Quantity Positive braking-acceleration magnitude, in meters per second squared. required
drive_limit Quantity Nonnegative drive speed rating, in meters per second. required
Returns
Name Type Description
DynamicWindowResult Reachable speed-window half-width and admissible speed in meters per second, plus whether the admissible speed exceeds the drive rating.
Notes

Equation: Half-width = max_acceleration*window; admissible_speed = sqrt(2*clear_distance*deceleration).

Assumptions: Constant acceleration over the renewal window and immediate constant-deceleration braking along an already selected arc.

Excludes: Pre-brake latency, jerk limits, margins, moving obstacles, and trajectory search.

References

Derivation: Integrate constant acceleration to obtain the reachable speed increment. Rearranging stopping distance v**2/(2*a) <= distance gives the admissibility ceiling.

Examples
>>> from mlsysim.solvers import DynamicWindowModel
>>> from mlsysim import Q_
>>> result = DynamicWindowModel().solve(
...     max_acceleration=Q_('1 m/s^2'),
...     window=Q_('0.1 s'),
...     clear_distance=Q_('1 m'),
...     deceleration=Q_('2 m/s^2'),
...     drive_limit=Q_('1 m/s'),
... )
>>> result.admits_drive_limit
True

HandoffExposureModel

engine.solvers.trajectory.HandoffExposureModel()

A per-handoff deadline budget read across a mission of K handoffs.

With independent misses at probability p, all K handoffs are on time with probability (1 - p)^K and p K are late on average. Holding a mission budget eps_M by the union bound leaves each handoff eps_M / K, the quantile 1 - eps_M / K, deeper than p by the ratio p K / eps_M.

Methods

Name Description
solve Translate repeated deadline misses into a mission exposure budget.
solve
engine.solvers.trajectory.HandoffExposureModel.solve(
    mission_time,
    replan_rate,
    late_probability,
    mission_budget,
)

Translate repeated deadline misses into a mission exposure budget.

Parameters
Name Type Description Default
mission_time Quantity Positive mission duration, convertible to seconds. required
replan_rate Quantity Positive handoff frequency in hertz; duration times rate must round to at least one handoff. required
late_probability float Per-handoff miss probability in (0, 1]; positive because reciprocal and logarithm are reported. required
mission_budget float Positive mission-level miss-probability budget, normally at most one. required
Returns
Name Type Description
HandoffExposureResult Handoff count, expected misses, dimensionless independent all-on-time probability, and the union-bound per-handoff budget and quantile.
See Also

mlsysim.physics.agents.calc_unchecked_success : Multiply independent per-event success probabilities.

Notes

Equation: K = round(mission_time * replan_rate), expected_late = K*p, all_on_time = (1-p)**K, and per_handoff_budget = mission_budget/K.

Assumptions: The all-on-time expression assumes independent identical miss probabilities. The budget allocation uses a union bound and does not require independence.

Excludes: Correlated-tail estimation, empirical deadline distributions, recovery, and a mission safety guarantee.

References

Derivation: Linearity of expectation gives K*p. Multiplying independent on-time probabilities gives (1-p)**K; summing event probabilities bounds any miss by K*p.

Examples
>>> from mlsysim.solvers import HandoffExposureModel
>>> from mlsysim import Q_
>>> result = HandoffExposureModel().solve(Q_('10 s'), Q_('2 Hz'), 0.01, 0.1)
>>> result.handoffs == 20 and result.design_quantile > 0.9
True

JerkLimitedStopModel

engine.solvers.trajectory.JerkLimitedStopModel()

A delayed jerk-limited (S-curve) stop, beside the constant and polynomial stops it replaces.

The machine travels v tau during the pre-brake delay, then stops along the double-S profile with deceleration bound a and jerk bound j (calc_scurve_stop_distance): above the plateau speed a^2 / j the stop is v^2 / (2 a) of braking plus v a / (2 j) of cruise over half a jerk ramp. Without a stated jerk bound, j is the peak jerk of the reference C2 polynomial stop (calc_c2_stop_suffix) at jerk_reference_speed (the entry speed by default), which stops in 0.75 v^2 / a. A localization bound and a protective margin, when stated, add to every required distance; the speed ceiling is the fastest entry speed whose delayed S-curve stop fits, with the jerk bound held fixed (calc_scurve_max_permitted_velocity).

Methods

Name Description
solve Compare a delayed S-curve stop with constant and polynomial braking.
solve
engine.solvers.trajectory.JerkLimitedStopModel.solve(
    speed,
    deceleration,
    jerk=None,
    jerk_reference_speed=None,
    delay=None,
    clear_distance=None,
    loc_margin=None,
    physical_margin=None,
)

Compare a delayed S-curve stop with constant and polynomial braking.

Parameters
Name Type Description Default
speed Quantity Positive initial speed, in meters per second. required
deceleration Quantity Positive magnitude of maximum braking acceleration, in meters per second squared. required
jerk Quantity Positive jerk bound in meters per second cubed; None derives it from the C2 polynomial reference stop. None
jerk_reference_speed Quantity Positive speed used only to derive omitted jerk; None uses speed. None
delay Quantity Nonnegative pre-brake duration; None means zero. None
clear_distance Quantity Available travel distance; None omits fit and speed-ceiling calculations. None
loc_margin Quantity Nonnegative localization-distance allowance; None means zero. None
physical_margin Quantity Nonnegative protective distance; None means zero. None
Returns
Name Type Description
JerkLimitedStopResult Braking distances in millimeters, times in milliseconds, jerk and acceleration bounds, and optional spare distance, fit flag and speed ceiling. Fit refers only to the supplied deterministic budget.
See Also

mlsysim.physics.robotics.stopping.calc_scurve_stop_distance : Integrate the bounded-jerk stopping profile. mlsysim.physics.robotics.stopping.calc_c2_stop_suffix : Construct the reference polynomial stopping profile.

Notes

Equation: Required distance is speed*delay + S_curve_distance(speed, deceleration, jerk) + margins. The plateau regime begins at speed = deceleration**2/jerk.

Assumptions: One-dimensional braking with a fixed positive deceleration and jerk limit, zero initial acceleration, and constant speed during delay.

Excludes: Slope, slip, changing traction, sensing distributions, actuator faults, and safety certification.

References

Derivation: Integrating the piecewise linear acceleration of the S-curve gives its travel and duration. Adding delay travel and explicit distance allowances forms the stopping budget.

Examples
>>> from mlsysim.solvers import JerkLimitedStopModel
>>> from mlsysim import Q_
>>> result = JerkLimitedStopModel().solve(
...     speed=Q_('1 m/s'),
...     deceleration=Q_('2 m/s^2'),
...     jerk=Q_('4 m/s^3'),
...     clear_distance=Q_('2 m'),
... )
>>> result.fits and result.scurve_travel > result.braking_travel
True

SeamBridgeModel

engine.solvers.trajectory.SeamBridgeModel()

A velocity gap at a chunk seam, closed in one servo tick or by a quintic bridge.

Closing a gap of delta in one tick asks the reflected rotor inertia N^2 J_rotor for J delta / dt of torque (calc_seam_acceleration_torque_jump), reached in one tick, a torque rate of J delta / dt^2. The C2 bridge over T, with zero boundary accelerations and an endpoint on the incoming reference, is the quintic q(t) = a3 t^3 + a4 t^4 + a5 t^5 (solved from its 3x3 boundary system); its acceleration peaks at 1.5 delta / T mid-bridge and its jerk at 6 delta / T^2 at both ends, so torque falls as 1 / T and torque rate as 1 / T^2.

Methods

Name Description
solve Compare a one-tick velocity correction with a quintic seam bridge.
solve
engine.solvers.trajectory.SeamBridgeModel.solve(
    gear_ratio,
    rotor_inertia,
    rated_torque,
    peak_torque,
    torque_rate_limit,
    velocity_gap,
    tick,
    bridge_duration,
    loaded_inertia=None,
)

Compare a one-tick velocity correction with a quintic seam bridge.

Parameters
Name Type Description Default
gear_ratio float Positive output-to-rotor speed ratio used to reflect rotor inertia. required
rotor_inertia Quantity Positive rotor inertia in kilogram meters squared. required
rated_torque Quantity Positive continuous torque rating in newton meters. required
peak_torque Quantity Positive peak torque rating used for the one-tick velocity ceiling. required
torque_rate_limit Quantity Positive permitted torque slew in newton meters per second. required
velocity_gap Quantity Positive joint-rate gap in radians per second. required
tick Quantity Positive servo period. required
bridge_duration Quantity Positive duration of the quintic correction. required
loaded_inertia Quantity Optional positive total load-side inertia for an additional one-tick comparison; None omits it. None
Returns
Name Type Description
SeamBridgeResult Reflected inertia, torques, torque rates, polynomial coefficients and bridge-duration bound; rate/rating comparison flags refer only to the modeled inertial correction.
See Also

mlsysim.physics.robotics.actuation.calc_seam_acceleration_torque_jump : Convert a joint acceleration jump into reflected-inertia torque.

Notes

Equation: J = gear_ratio**2*rotor_inertia; step torque = J*velocity_gap/tick. The bridge peaks at 1.5*J*velocity_gap/T in torque and 6*J*velocity_gap/T**2 in torque rate.

Assumptions: Zero correction acceleration at both endpoints, fixed reflected inertia and a quintic endpoint matching velocity gap and half-gap displacement.

Excludes: Gravity, friction, elasticity, actuator bandwidth, saturation response, and full loaded dynamics unless loaded_inertia is supplied.

References

Derivation: Solve the three endpoint equations for the cubic, quartic and quintic coefficients, differentiate to acceleration and jerk, then multiply by reflected inertia.

Examples
>>> from mlsysim.solvers import SeamBridgeModel
>>> from mlsysim import Q_
>>> result = SeamBridgeModel().solve(
...     gear_ratio=10,
...     rotor_inertia=Q_('0.001 kg*m^2'),
...     rated_torque=Q_('10 N*m'),
...     peak_torque=Q_('20 N*m'),
...     torque_rate_limit=Q_('1000 N*m/s'),
...     velocity_gap=Q_('0.1 rad/s'),
...     tick=Q_('1 ms'),
...     bridge_duration=Q_('20 ms'),
... )
>>> result.peak_torque < result.step_torque
True

ShoulderSwingModel

engine.solvers.trajectory.ShoulderSwingModel()

The loaded shoulder: holding torque, effective inertia, and a rest-to-rest swing.

Holding payload m at reach r costs m g r of torque; the payload and the reflected rotor inertia give J = m r^2 + J_refl (link masses omitted, a lower bound). Gravity, held at its horizontal value, makes the torque-limited acceleration (tau_max - tau_g) / J lifting and (tau_max + tau_g) / J braking; the binding acceleration is the smallest of those and the joint limit. The time-optimal (bang-bang) swing of D takes 2 sqrt(D / a) and steps torque by 2 J a at the switch point. A torque-rate limit bounds jerk at taud / J, and the jerk-limited swing is the double-S without cruise (calc_scurve_rest_to_rest_time).

Methods

Name Description
solve Bound a loaded shoulder swing using torque and torque-rate limits.
solve
engine.solvers.trajectory.ShoulderSwingModel.solve(
    payload,
    reach,
    torque_limit,
    reflected_inertia,
    swing,
    acceleration_limit,
    velocity_limit,
    torque_rate_limit,
)

Bound a loaded shoulder swing using torque and torque-rate limits.

Parameters
Name Type Description Default
payload Quantity Nonnegative point-payload mass, convertible to kilograms. required
reach Quantity Positive payload lever arm, convertible to meters. required
torque_limit Quantity Positive torque ceiling that must exceed horizontal gravity torque for lifting. required
reflected_inertia Quantity Positive reflected rotor inertia, in kilogram meters squared. required
swing Quantity Positive rest-to-rest angular displacement in radians. required
acceleration_limit Quantity Positive kinematic joint acceleration ceiling in rad/s squared. required
velocity_limit Quantity Positive joint speed rating; checked after computing the unconstrained profile. required
torque_rate_limit Quantity Positive torque slew bound, in newton meters per second. required
Returns
Name Type Description
ShoulderSwingResult Holding torque, effective inertia, lift/brake acceleration, bang-bang and jerk-limited durations in milliseconds, peak rates and a velocity-rating flag. The velocity limit is checked, not used to replan the profile.
See Also

mlsysim.physics.robotics.stopping.calc_scurve_rest_to_rest_time : Integrate a symmetric bounded-jerk move without cruise.

Notes

Equation: J = payload*reach**2 + reflected_inertia and gravity torque = payload*g*reach. Acceleration is the minimum of lifting, braking and kinematic limits; jerk = torque_rate_limit/J.

Assumptions: A point payload, horizontal gravity torque held constant through the swing, and rest-to-rest symmetric acceleration profiles.

Excludes: Link inertia, changing gravity geometry, friction, velocity-capped replanning, flexibility, and motor electrical limits.

References

Derivation: Torque balance gives angular acceleration after subtracting gravity. Integrating symmetric acceleration gives the bang-bang time; integrating a bounded-jerk acceleration profile gives the S-curve comparison.

Examples
>>> from mlsysim.solvers import ShoulderSwingModel
>>> from mlsysim import Q_
>>> result = ShoulderSwingModel().solve(
...     payload=Q_('1 kg'),
...     reach=Q_('0.5 m'),
...     torque_limit=Q_('20 N*m'),
...     reflected_inertia=Q_('0.1 kg*m^2'),
...     swing=Q_('0.5 rad'),
...     acceleration_limit=Q_('2 rad/s^2'),
...     velocity_limit=Q_('10 rad/s'),
...     torque_rate_limit=Q_('100 N*m/s'),
... )
>>> result.jerk_limited_time >= result.bang_bang_time
True

SpillLimitedStopModel

engine.solvers.trajectory.SpillLimitedStopModel()

The stop of a machine carrying an open container, whose liquid caps the deceleration.

Under steady deceleration a the free surface tilts until the liquid rises R a / g at the wall; keeping it below the rim’s freeboard h_f caps the deceleration at g h_f / R (calc_quasistatic_spill_acceleration). The stop at that bound keeps the stop’s shape, so its jerk bound is rescaled with the deceleration (the reference polynomial’s peak at the entry speed); the carry speed is the fastest entry speed whose delayed stop fits.

Methods

Name Description
solve Compute a stopping budget under a quasistatic spill constraint.
solve
engine.solvers.trajectory.SpillLimitedStopModel.solve(
    speed,
    free_deceleration,
    free_jerk,
    delay,
    clear_distance,
    inner_radius,
    freeboard,
)

Compute a stopping budget under a quasistatic spill constraint.

Parameters
Name Type Description Default
speed Quantity Positive carrying speed in meters per second. required
free_deceleration Quantity Positive unconstrained braking deceleration in meters per second squared. required
free_jerk Quantity Positive reference jerk bound in meters per second cubed, used for the reused-jerk comparison. required
delay Quantity Nonnegative pre-brake delay. required
clear_distance Quantity Positive available travel distance. required
inner_radius Quantity Positive horizontal radius of the open container. required
freeboard Quantity Positive vertical liquid-to-rim clearance. required
Returns
Name Type Description
SpillLimitedStopResult Spill-limited deceleration, predicted liquid rise in millimeters, nested jerk-limited stop, distance overrun and admissible carrying speed. The spill flag is a quasistatic comparison.
See Also

mlsysim.physics.robotics.actuation.calc_quasistatic_spill_acceleration : Convert container freeboard into an acceleration bound. JerkLimitedStopModel.solve : Compose delay, braking travel, and explicit distance allowances.

Notes

Equation: Allowed deceleration is g*freeboard/inner_radius; rise under unconstrained braking is inner_radius*free_deceleration/g. The constrained stop recomputes the polynomial-derived jerk at that deceleration.

Assumptions: A level open container, quasistatic free surface, fixed geometry and one-dimensional stopping.

Excludes: Transient sloshing, surface tension, container tilt, active stabilization, and a guarantee against spilling.

References

Derivation: In the accelerating frame the free-surface slope is acceleration/g. Multiplying the slope by radius gives rim rise and solving the freeboard inequality gives the acceleration ceiling.

Examples
>>> from mlsysim.solvers import SpillLimitedStopModel
>>> from mlsysim import Q_
>>> result = SpillLimitedStopModel().solve(
...     speed=Q_('1 m/s'),
...     free_deceleration=Q_('2 m/s^2'),
...     free_jerk=Q_('4 m/s^3'),
...     delay=Q_('10 ms'),
...     clear_distance=Q_('2 m'),
...     inner_radius=Q_('0.1 m'),
...     freeboard=Q_('0.01 m'),
... )
>>> result.spill_deceleration < Q_('2 m/s^2')
True

StaleAnchorModel

engine.solvers.trajectory.StaleAnchorModel()

How far a moving reference runs past a pose sampled when a replacement was requested.

A joint turning at omega for the replacement delay moves omega x delay; at a lever arm r that is up to omega x delay x r of tool motion, the step backward a plan anchored at the stale pose would command.

Methods

Name Description
solve Calculate angular drift and arc-length displacement of a stale pose.
solve
engine.solvers.trajectory.StaleAnchorModel.solve(joint_speed, delay, lever_arm)

Calculate angular drift and arc-length displacement of a stale pose.

Parameters
Name Type Description Default
joint_speed Quantity Constant joint angular rate, convertible to radians per second; signed rates preserve displacement direction. required
delay Quantity Nonnegative elapsed duration since the pose was sampled. required
lever_arm Quantity Nonnegative distance from the joint axis to the tool. required
Returns
Name Type Description
StaleAnchorResult Signed joint displacement in radians and degrees and signed tool arc-length displacement in millimeters. Arc length bounds chord length for the same rotation magnitude.
Notes

Equation: Angular gap = joint_speed*delay; tool arc displacement = gap_in_radians*lever_arm.

Assumptions: Constant angular rate about one fixed axis and a rigid lever arm.

Excludes: Other joints, translation, changing speed, full pose composition, and a measured tracking-error estimate.

References

Derivation: Integrating constant angular rate gives angle; multiplying that angle in radians by radius gives arc length.

Examples
>>> from mlsysim.solvers import StaleAnchorModel
>>> from mlsysim import Q_
>>> result = StaleAnchorModel().solve(Q_('1 rad/s'), Q_('10 ms'), Q_('0.5 m'))
>>> result.tool_displacement == Q_('5 mm')
True

TrajectoryDeadlinesModel

engine.solvers.trajectory.TrajectoryDeadlinesModel()

The deadlines a trajectory record carries, and the cruise charged before its stop begins.

A replacement requested request_delay after the schedule origin, with a design-tail latency target and scheduling slack, is admitted at the preferred admission; the full reserve adds the decision-to-onset response. The matched stop must physically begin at the commitment instant, so admission closes one response earlier; the arm rests one stop time after commitment. Cruise from the blend deadline to commitment is charged before the stop.

Methods

Name Description
solve Place admission, commitment, and rest on a common trajectory timeline.
solve
engine.solvers.trajectory.TrajectoryDeadlinesModel.solve(
    setpoint_period,
    horizon,
    renewal_period,
    request_delay,
    latency_target,
    schedule_slack,
    response,
    blend,
    commit,
    stop_time,
    stop_distance,
    speed,
    clear_distance,
    late_wait,
)

Place admission, commitment, and rest on a common trajectory timeline.

Parameters
Name Type Description Default
setpoint_period Quantity Positive duration between successive setpoints. required
horizon int Positive count of setpoints in the nominal chunk. required
renewal_period Quantity Positive replacement-request cadence. required
request_delay Quantity Nonnegative request instant relative to the schedule origin. required
latency_target Quantity Nonnegative request-to-admission design-tail latency allocation. required
schedule_slack Quantity Nonnegative scheduling reserve. required
response Quantity Nonnegative decision-to-brake-onset response duration. required
blend Quantity Blend-completion instant relative to the same schedule origin. required
commit Quantity Stop-commitment instant, normally no earlier than blend. required
stop_time Quantity Nonnegative duration from brake onset to rest. required
stop_distance Quantity Nonnegative travel during the matched stop. required
speed Quantity Nonnegative cruise speed before stop commitment. required
clear_distance Quantity Available travel distance measured at the blend deadline. required
late_wait Quantity Nonnegative extra wait after a missed admission deadline. required
Returns
Name Type Description
TrajectoryDeadlinesResult Deadlines, timing reserves and rest instant in milliseconds; cruise travel, consumed distance, remaining margin and late breach in millimeters. Negative margins identify budget overruns.
Notes

Equation: Preferred admission = request_delay + latency_target + schedule_slack; cutoff = commit-response. Used distance = speed*(commit-blend) + stop_distance.

Assumptions: All instants share one origin, cruise speed is constant until commitment, and stop_time and stop_distance describe the same stop.

Excludes: Trajectory generation, stochastic latency estimation, obstacle motion, and enforcement of deadline ordering.

References

Derivation: Subtract the onset response from the commitment instant to obtain the last admission instant. Integrate constant cruise speed over commit-blend, then add the supplied stop distance.

Examples
>>> from mlsysim.solvers import TrajectoryDeadlinesModel
>>> from mlsysim import Q_
>>> result = TrajectoryDeadlinesModel().solve(
...     setpoint_period=Q_('1 ms'),
...     horizon=100,
...     renewal_period=Q_('10 ms'),
...     request_delay=Q_('10 ms'),
...     latency_target=Q_('20 ms'),
...     schedule_slack=Q_('5 ms'),
...     response=Q_('5 ms'),
...     blend=Q_('10 ms'),
...     commit=Q_('50 ms'),
...     stop_time=Q_('100 ms'),
...     stop_distance=Q_('100 mm'),
...     speed=Q_('1 m/s'),
...     clear_distance=Q_('200 mm'),
...     late_wait=Q_('10 ms'),
... )
>>> result.margin > Q_('0 mm')
True

TwoLinkJointRateModel

engine.solvers.trajectory.TwoLinkJointRateModel()

Joint rates a tool speed asks of a planar two-link arm, exact and damped.

The weakest direction of the Jacobian at elbow angle q2 has singular value sigma_min; a tool speed v along it needs a joint-rate vector of norm v / sigma_min, and with two joints at least one component is that norm divided by sqrt(2). Damped least squares with damping lambda commands v sigma / (sigma^2 + lambda^2), never more than v / (2 lambda), and delivers the fraction sigma^2 / (sigma^2 + lambda^2) of the tool motion.

Methods

Name Description
solve Compare exact and damped joint rates in the weakest tool direction.
solve
engine.solvers.trajectory.TwoLinkJointRateModel.solve(
    upper_arm,
    forearm,
    elbow_angle,
    tool_speed,
    joint_speed_limit,
    damping,
)

Compare exact and damped joint rates in the weakest tool direction.

Parameters
Name Type Description Default
upper_arm Quantity Positive upper-link length, convertible to meters. required
forearm Quantity Positive lower-link length, convertible to meters. required
elbow_angle Quantity Elbow configuration, convertible to radians; avoid a singular pose when calculating the exact rate. required
tool_speed Quantity Nonnegative tool-speed magnitude in meters per second along the weakest singular direction. required
joint_speed_limit Quantity Positive allowed joint rate in radians per second. required
damping Quantity Positive damped-least-squares coefficient, in meters under the Jacobian convention. required
Returns
Name Type Description
TwoLinkJointRateResult Jacobian singular values in meters, joint rates in rad/s, realized motion fraction, and rate-limit comparison flags. These flags do not certify reachability of an arbitrary trajectory.
See Also

mlsysim.physics.robotics.kinematics.calc_two_link_singular_values : Compute the two-link Jacobian singular values. mlsysim.physics.robotics.kinematics.calc_dls_joint_rate : Apply the scalar damped inverse along a singular direction.

Notes

Equation: For the smaller Jacobian singular value sigma, the exact joint-rate norm is v/sigma; at least one of two components is at least that norm/sqrt(2). The damped rate is v*sigma/(sigma**2 + damping**2).

Assumptions: A rigid planar two-link arm; motion lies in its weakest singular direction. Damping is fixed and positive.

Excludes: Joint acceleration, torque, obstacles, tracking dynamics, and other tool-motion directions.

References

Derivation: The singular-value decomposition reduces inverse kinematics along one direction to scalar division. Adding a squared-rate penalty replaces 1/sigma with sigma/(sigma**2 + damping**2).

Examples
>>> from mlsysim.solvers import TwoLinkJointRateModel
>>> from mlsysim import Q_
>>> result = TwoLinkJointRateModel().solve(
...     upper_arm=Q_('0.5 m'),
...     forearm=Q_('0.5 m'),
...     elbow_angle=Q_('90 deg'),
...     tool_speed=Q_('0.1 m/s'),
...     joint_speed_limit=Q_('2 rad/s'),
...     damping=Q_('0.05 m'),
... )
>>> 0 < result.realized_fraction < 1
True
Back to top