moonbitstack/moonmcl/kinematics does not have a README file

    Ackermann

    pub(all) struct Ackermann {
    wheelbase : Double
    track : Double
    } derive(
    Debug
    )

    An Ackermann steering base: the inner and outer front wheels turn by different angles about a common centre.

    Ackermann::angles

    fn Ackermann::angles(self : Ackermann, curvature~ : Double) -> (Double, Double)

    The inner and outer steering angles for a curvature: the wheel on the inside of the turn has to turn further, by the angle its shorter radius demands.

    Ackermann::new

    fn Ackermann::new(wheelbase~ : Double, track~ : Double) -> Ackermann raise
    Refused

    An Ackermann base with the given wheelbase and track.

    Bicycle

    pub(all) struct Bicycle {
    wheelbase : Double
    } derive(
    Debug
    )

    A bicycle model: the joint space is (speed, steering angle) and the task space the body twist (vx, vy, omega).

    Bicycle::curvature

    fn Bicycle::curvature(self : Bicycle, steering~ : Double) -> Double

    The curvature a steering angle gives.

    Bicycle::new

    fn Bicycle::new(wheelbase~ : Double) -> Bicycle raise
    Refused

    A bicycle with the given wheelbase.

    Bicycle::steering

    fn Bicycle::steering(self : Bicycle, curvature~ : Double) -> Double

    The steering angle a curvature needs.

    Bicycle::to_repr

    Delta

    pub(all) struct Delta {
    base_radius : Double
    platform_radius : Double
    upper_arm : Double
    lower_arm : Double
    } derive(
    Debug
    )

    A delta robot: three parallel arms from a fixed base to a moving platform.

    The joint space is the three upper-arm angles measured from horizontal and the task space the platform centre (x, y, z) under the base.
    impl Kinematics for Delta

    Delta::elbows

    The three elbows, in the base frame, for the upper-arm angles q.

    A drawing of the cell needs the elbows as well as the platform, and the cell already computes them to solve its own forward map.

    Delta::new

    fn Delta::new(base_radius~ : Double, platform_radius~ : Double, upper_arm~ : Double, lower_arm~ : Double) -> Delta raise
    Refused

    A delta cell with the given geometry.

    Delta::to_repr

    Differential

    pub(all) struct Differential {
    wheel_radius : Double
    track : Double
    } derive(
    Debug
    )

    A two-wheel differential drive.

    track is the distance between the wheels and wheel_radius the radius of each. The joint space is (omega_left, omega_right) in radians per second and the task space (v, omega) in metres and radians per second.

    Differential::advance

    The pose after driving twist for dt seconds.

    The arc is integrated exactly: a straight chord would cut the corner of every turn, and the error grows with the square of the period.

    Differential::new

    fn Differential::new(wheel_radius~ : Double, track~ : Double) -> Differential raise
    Refused

    A differential drive with the given wheel radius and track width.

    Gantry

    pub(all) struct Gantry {
    track : Double
    } derive(
    Debug
    )

    A gantry: two motors drive one gantry axis from either end, so the pair sets the position and the tilt of the beam.

    The joint space is (x, y_left, y_right, z) and the task space (x, y, z, tilt), where y is the middle of the beam and tilt the angle the difference between its ends makes.

    Gantry::new

    A gantry with the given beam length.

    Gantry::to_repr

    Mecanum

    pub(all) struct Mecanum {
    wheel_radius : Double
    half_length : Double
    half_width : Double
    } derive(
    Debug
    )

    A four-wheel mecanum base. The joint space is the four wheel speeds in the order front left, front right, rear left, rear right, and the task space the body twist (vx, vy, omega).

    Mecanum::new

    fn Mecanum::new(wheel_radius~ : Double, half_length~ : Double, half_width~ : Double) -> Mecanum raise
    Refused

    A mecanum base with the given wheel radius and half extents.

    Mecanum::to_repr

    Omnidirectional

    pub(all) struct Omnidirectional {
    wheel_radius : Double
    radius : Double
    angles : Array[Double]
    } derive(
    Debug
    )

    An omnidirectional base with three or more driven wheels on a circle.

    The wheels are mounted tangentially, so each one drives along theta and the map from twist to wheel speeds is one row per wheel. With three wheels it inverts exactly; with more the inverse is the least-squares one, which spreads the effort over the wheels that can help.

    Omnidirectional::new

    fn Omnidirectional::new(wheel_radius~ : Double, radius~ : Double, angles~ : ArrayView[Double]) -> Omnidirectional raise
    Refused

    An omnidirectional base whose wheel i sits at angles[i] radians on a circle of radius.

    PlanarArm

    pub(all) struct PlanarArm {
    lengths : Array[Double]
    } derive(
    Debug
    )

    A planar chain of n links. The joint space is the joint angles and the task space the (x, y) of the tip.

    PlanarArm::jacobian_analytic

    The analytic Jacobian of the arm at the joint angles q: how far the tip moves for a small change in each joint.

    Link k and everything outboard of it turn with joint k, so column k is that joint's direction rotated by the total angle up to k, scaled by the reach still in front of it. Kinematics::jacobian defaults to a central difference; this is the same matrix in closed form.

    PlanarArm::new

    A planar arm with the given link lengths.

    PlanarArm::solve

    fn PlanarArm::solve(self : PlanarArm, target~ :
    Vec
    , seed~ :
    Vec
    , iterations? : Int, damping? : Double, tolerance? : Double) ->
    Vec
    raise
    Refused

    The joint angles that put the tip on target, by damped least squares.

    The damping is what makes the solve usable near a singularity: without it the Jacobian's inverse blows up and the joint velocities with it, which on a real arm is a torque the drive cannot deliver. damping is the square of the smallest singular value the solve allows.

    Scara

    pub(all) struct Scara {
    upper_arm : Double
    forearm : Double
    vertical : Double
    } derive(
    Debug
    )

    A SCARA arm: two revolute joints about the vertical axis and one prismatic joint along it.

    Scara::new

    fn Scara::new(upper_arm~ : Double, forearm~ : Double, vertical~ : Double) -> Scara raise
    Refused

    A SCARA with the two link lengths and the vertical stroke.

    Scara::to_repr