pub trait Mechanism: Send {
Show 43 methods
// Required methods
fn dynamics(
&self,
q: &[f64],
qd: &[f64],
mass: &mut [f64],
bias: &mut [f64],
);
fn potential(&self, q: &[f64]) -> f64;
fn set_payload_attached(&mut self, attached: bool);
fn scene(
&self,
q: &[f64],
rotors: &[f64],
rotor_speeds: &[f64],
out: &mut Scene,
);
// Provided methods
fn passive_joints(&self) -> Vec<(f64, f64)> { ... }
fn passive_signals(&self) -> Vec<SignalInfo> { ... }
fn passive_loss_row(&self) -> Option<(&'static str, &'static str)> { ... }
fn passive_rest(&self, _q: &[f64]) -> Vec<f64> { ... }
fn passive_shift(&self, _q: &[f64], _passive: &[f64], out: &mut [f64]) { ... }
fn passive_extra_damping(&self) -> Vec<f64> { ... }
fn passive_in_modes(&self) -> usize { ... }
fn loss_row(&self) -> Option<(&'static str, &'static str)> { ... }
fn loss_power(&self, _q: &[f64], _qd: &[f64]) -> f64 { ... }
fn linear_motor(&self) -> bool { ... }
fn links(&self) -> Vec<String> { ... }
fn set_link_change(&mut self, _link: usize, _factor: f64, _moment: [f64; 3]) { ... }
fn forward(&self, q: &[f64], tool: &mut [f64]) { ... }
fn inverse(&self, tool: &[f64], q: &mut [f64]) -> bool { ... }
fn memory(&self) -> Vec<f64> { ... }
fn set_memory(&self, _memory: &[f64]) { ... }
fn unreachable(&self, _tool: &[f64], _slack: f64) -> Option<&'static str> { ... }
fn condition(&self, _tool: &[f64]) -> Option<f64> { ... }
fn tool_is_joints(&self) -> bool { ... }
fn has_process(&self) -> bool { ... }
fn process_torque(&self, _q: &[f64], _qd: &[f64], _out: &mut [f64]) { ... }
fn cam(&self) -> Option<CamMaster> { ... }
fn cam_at(&self, _master: f64, _out: &mut [[f64; 4]]) { ... }
fn cam_curve(&self) -> Option<CamCurve> { ... }
fn signal_infos(&self) -> Vec<SignalInfo> { ... }
fn signals(
&self,
_q: &[f64],
_qd: &[f64],
_qdd: &[f64],
_force: &[f64],
_out: &mut Vec<f64>,
) { ... }
fn reads_jerk(&self) -> bool { ... }
fn signals_with_jerk(
&self,
q: &[f64],
qd: &[f64],
qdd: &[f64],
_qddd: &[f64],
force: &[f64],
out: &mut Vec<f64>,
) { ... }
fn rating_checks(&self) -> Vec<RatingCheck> { ... }
fn rigid_guide_loads(
&self,
_tool: &[f64],
_acc: &[f64],
_out: &mut Vec<[f64; 2]>,
) { ... }
fn collision_parts(&self) -> &'static [&'static str] { ... }
fn collision_links(&self) -> &'static [&'static str] { ... }
fn frame_momentum(
&self,
_q: &[f64],
_qd: &[f64],
_rotor_spin: &[f64],
) -> Option<FrameMomentum> { ... }
fn flex_modes(&self) -> Vec<FlexMode> { ... }
fn flex_loads(
&self,
_q: &[f64],
_qd: &[f64],
_qdd: &[f64],
_out: &mut [f64],
) { ... }
fn flex_shift(&self, _q: &[f64], _deflection: &[f64], _out: &mut [f64]) { ... }
fn static_shift(&self, _q: &[f64], out: &mut [f64]) { ... }
fn flex_coupling(
&self,
_q: &[f64],
_qd: &[f64],
_d: &[f64],
_dd: &[f64],
) -> Option<FlexCoupling> { ... }
fn scene_point(&self, _tool: &[f64]) -> Option<[f64; 3]> { ... }
}Expand description
What a mechanism tells the joint machine.
Required Methods§
Sourcefn dynamics(&self, q: &[f64], qd: &[f64], mass: &mut [f64], bias: &mut [f64])
fn dynamics(&self, q: &[f64], qd: &[f64], mass: &mut [f64], bias: &mut [f64])
The load’s mass matrix M (n x n, row by row, without the rotors) and h with M q’’ + h = the torques (forces) at
the joints: velocity terms plus gravity. With the payload as it is attached. Where the mechanism has passive
joints (passive_joints), q and q’ hold them after the driven ones, and M and h are of them all.
Sourcefn potential(&self, q: &[f64]) -> f64
fn potential(&self, q: &[f64]) -> f64
The load’s potential energy (passive joints included, their springs not); its gravity torques are those of h at rest.
fn set_payload_attached(&mut self, attached: bool)
Provided Methods§
Sourcefn passive_joints(&self) -> Vec<(f64, f64)>
fn passive_joints(&self) -> Vec<(f64, f64)>
Joints that no motor drives, after the driven ones (a payload swinging on the flange): each with its spring (N m/rad) and damper (N m s/rad) towards zero. None by default.
Sourcefn passive_signals(&self) -> Vec<SignalInfo>
fn passive_signals(&self) -> Vec<SignalInfo>
The passive joints’ position signals, one per joint in their order (their values are the joints’ positions):
by default those of a payload swinging on the flange, swing.<k>.angle.
Sourcefn passive_loss_row(&self) -> Option<(&'static str, &'static str)>
fn passive_loss_row(&self) -> Option<(&'static str, &'static str)>
The id (power.<id>) and the owner’s key of the loss row of the passive joints’ dampers: by default the swinging
payload’s. None (no row) only where every passive joint’s damper is zero.
Sourcefn passive_rest(&self, _q: &[f64]) -> Vec<f64>
fn passive_rest(&self, _q: &[f64]) -> Vec<f64>
The passive joints’ positions at rest with the driven ones at q (a contact pressed in by its load): all zero by
default.
Sourcefn passive_shift(&self, _q: &[f64], _passive: &[f64], out: &mut [f64])
fn passive_shift(&self, _q: &[f64], _passive: &[f64], out: &mut [f64])
How far the tool pose moves at joints q (the driven ones) when the passive joints stand at passive rather than
at zero, into out (zeroed first): a forearm rocking on its rod. Zero by default (a swinging payload’s joints
do not move the flange’s frame).
Sourcefn passive_extra_damping(&self) -> Vec<f64>
fn passive_extra_damping(&self) -> Vec<f64>
The damping (N m s/rad) of each passive joint’s own damper that dynamics applies (not in passive_joints’
pair), in their order, for the modes’ damping figures; missing entries 0.
Sourcefn passive_in_modes(&self) -> usize
fn passive_in_modes(&self) -> usize
How many of the first passive joints the arm’s trains and held modes take free (a rocking forearm: stiff, but a mode of its own), rather than hold. 0 by default.
Sourcefn loss_row(&self) -> Option<(&'static str, &'static str)>
fn loss_row(&self) -> Option<(&'static str, &'static str)>
A loss row of the mechanism’s own (a contact’s damper, a guide’s friction), booked beside the joints’ and the
two-way modes’: its id (power.<id>) and the owner’s key; None (no row) by default.
Sourcefn loss_power(&self, _q: &[f64], _qd: &[f64]) -> f64
fn loss_power(&self, _q: &[f64], _qd: &[f64]) -> f64
The power the row of loss_row takes out, W, at all joints’ q and qd (passive ones included): 0 by default.
Sourcefn linear_motor(&self) -> bool
fn linear_motor(&self) -> bool
Whether the motors are linear motors (their signals in m, m/s, N): Machine::motor_linear. False by default.
Sourcefn links(&self) -> Vec<String>
fn links(&self) -> Vec<String>
As Machine::links and Machine::set_link_change: the bodies whose inertial parameters a trace can be fitted for.
fn set_link_change(&mut self, _link: usize, _factor: f64, _moment: [f64; 3])
Sourcefn forward(&self, q: &[f64], tool: &mut [f64])
fn forward(&self, q: &[f64], tool: &mut [f64])
Joints to tool pose. The joints themselves by default.
Sourcefn inverse(&self, tool: &[f64], q: &mut [f64]) -> bool
fn inverse(&self, tool: &[f64], q: &mut [f64]) -> bool
Tool pose to joints; false where it cannot be reached.
Sourcefn memory(&self) -> Vec<f64>
fn memory(&self) -> Vec<f64>
What inverse carries from one call to the next (a numerical inverse’s last solution, which the next starts
from), as a fixed count of numbers, for Machine::memory. None by default.
Sourcefn set_memory(&self, _memory: &[f64])
fn set_memory(&self, _memory: &[f64])
Sets back what memory gave (empty: none, as before the first inverse), as inverse keeps it: behind a lock.
fn unreachable(&self, _tool: &[f64], _slack: f64) -> Option<&'static str>
Sourcefn condition(&self, _tool: &[f64]) -> Option<f64>
fn condition(&self, _tool: &[f64]) -> Option<f64>
Machine::condition at a tool pose; None where the tool is the joints.
Sourcefn tool_is_joints(&self) -> bool
fn tool_is_joints(&self) -> bool
Whether the tool pose is the joints themselves (forward and inverse as by default): then the joint speeds and
accelerations are the tool’s, without going through the Jacobian.
Sourcefn has_process(&self) -> bool
fn has_process(&self) -> bool
Whether the mechanism works on a process (a press force, a cut), which process_torque gives: then the machine
reports the power given to it as power.process. None by default.
Sourcefn process_torque(&self, _q: &[f64], _qd: &[f64], _out: &mut [f64])
fn process_torque(&self, _q: &[f64], _qd: &[f64], _out: &mut [f64])
Adds the torques (forces) the process puts on the joints at positions q and speeds qd to out, positive
turning a joint up. Not conservative and not in dynamics: the torque breakdown counts it among the rest, and
the feedforward leaves it out, as a drive does not know it.
Sourcefn cam(&self) -> Option<CamMaster>
fn cam(&self) -> Option<CamMaster>
As Machine::cam and Machine::cam_at: an electronic cam the mechanism runs as its cycle, its slaves the tool
axes. None by default.
fn cam_at(&self, _master: f64, _out: &mut [[f64; 4]])
fn cam_curve(&self) -> Option<CamCurve>
Sourcefn signal_infos(&self) -> Vec<SignalInfo>
fn signal_infos(&self) -> Vec<SignalInfo>
The mechanism’s own signals, after the machine’s: their infos, and their values from joint positions, speeds, accelerations and the force (torque) each transmission passes to its joint.
fn signals( &self, _q: &[f64], _qd: &[f64], _qdd: &[f64], _force: &[f64], _out: &mut Vec<f64>, )
Sourcefn reads_jerk(&self) -> bool
fn reads_jerk(&self) -> bool
Whether a signal needs the joints’ jerk q’‘’ (signals_with_jerk): the chain works it out only then, as it costs
three more evaluations of the machine’s derivatives.
Sourcefn signals_with_jerk(
&self,
q: &[f64],
qd: &[f64],
qdd: &[f64],
_qddd: &[f64],
force: &[f64],
out: &mut Vec<f64>,
)
fn signals_with_jerk( &self, q: &[f64], qd: &[f64], qdd: &[f64], _qddd: &[f64], force: &[f64], out: &mut Vec<f64>, )
signals with the joints’ jerk as well, for a mechanism that reads_jerk; zeros where it does not.
fn rating_checks(&self) -> Vec<RatingCheck>
Sourcefn rigid_guide_loads(
&self,
_tool: &[f64],
_acc: &[f64],
_out: &mut Vec<[f64; 2]>,
)
fn rigid_guide_loads( &self, _tool: &[f64], _acc: &[f64], _out: &mut Vec<[f64; 2]>, )
As Machine::rigid_guide_loads: the loads of the guides among signals, at a tool pose and acceleration.
Sourcefn collision_parts(&self) -> &'static [&'static str]
fn collision_parts(&self) -> &'static [&'static str]
The ids of the boxes scene draws that move with the load and can hit an obstacle (Machine::collision_bodies).
Sourcefn collision_links(&self) -> &'static [&'static str]
fn collision_links(&self) -> &'static [&'static str]
The ids of the segments scene draws, in order from the base to the tool, as the links that the check of the
machine’s own parts looks at (Machine::self_collision_capsules): each a capsule of half its width, not an
obstacle’s part. Empty by default: the machine’s own parts are then those of collision_parts.
Sourcefn frame_momentum(
&self,
_q: &[f64],
_qd: &[f64],
_rotor_spin: &[f64],
) -> Option<FrameMomentum>
fn frame_momentum( &self, _q: &[f64], _qd: &[f64], _rotor_spin: &[f64], ) -> Option<FrameMomentum>
For effects.base_compliance (Machine::frame_momentum): the load’s momentum at joints q and speeds qd (passive
ones included), in the frame of the tool pose’s x, y, z, each driven joint’s rotor adding rotor_spin (its
inertia times its speed: N m s, or N s for a linear motor’s forcer) along its own axis. None by default.
Sourcefn flex_modes(&self) -> Vec<FlexMode>
fn flex_modes(&self) -> Vec<FlexMode>
Bending modes of the load’s links (effects.link_bending): its motion drives them and they move the tool; the
joints feel them only where flex_coupling gives them two-way, else not (one-way, as base::Based). Their count
must not change. Empty by default.
Sourcefn flex_loads(&self, _q: &[f64], _qd: &[f64], _qdd: &[f64], _out: &mut [f64])
fn flex_loads(&self, _q: &[f64], _qd: &[f64], _qdd: &[f64], _out: &mut [f64])
The force on each of flex_modes at the driven joints’ positions q, speeds qd and accelerations qdd, in its
coordinate (N).
Sourcefn flex_shift(&self, _q: &[f64], _deflection: &[f64], _out: &mut [f64])
fn flex_shift(&self, _q: &[f64], _deflection: &[f64], _out: &mut [f64])
How far the tool pose moves at joints q when the modes deflect by deflection, into out (zeroed first).
Sourcefn static_shift(&self, _q: &[f64], out: &mut [f64])
fn static_shift(&self, _q: &[f64], out: &mut [f64])
How far the tool pose moves at joints q by the bending’s static part that has no coordinate of its own (the
weights’ load on a shape without inertia, state-free), into out (zeroed first): zero by default.
Sourcefn flex_coupling(
&self,
_q: &[f64],
_qd: &[f64],
_d: &[f64],
_dd: &[f64],
) -> Option<FlexCoupling>
fn flex_coupling( &self, _q: &[f64], _qd: &[f64], _d: &[f64], _dd: &[f64], ) -> Option<FlexCoupling>
effects.link_bending_reaction: the modes two-way, coordinates of their own beside the joints, at all joints’ q and
qd (passive ones included) and the modes’ deflections d and rates dd (FlexCoupling). None where they are
one-way (flex_loads), the default.
fn scene_point(&self, _tool: &[f64]) -> Option<[f64; 3]>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".