Skip to main content

Module motion

Module motion 

Source
Expand description

The C ABI for the motion helpers: chassis kinematics, an arm, odometry, waypoint guidance, the safety gate, and the conversions to servo, ESC, and encoder units.

These wrap the robotics half of pamoja_kit. The kinematic models, the arm, the waypoint follower, and the servo, ESC, and encoder scales hold only their parameters and never change, so each crosses by value as a small struct the caller fills in and passes to every call; the helper applies the same fallbacks the Rust constructor does, such as taking a length’s magnitude. The helpers that remember something between calls, the odometry, the e-stop, the watchdog, the limits, the safety gate, and the quadrature decoder, are opaque handles, each with its own _free. A constructor never returns null, and each method documents what it returns for a null handle.

Structs§

PamojaAckermann
Car-like steering: one steered axle and a driven axle wheelbase apart.
PamojaBodyMotion
A planar body motion: a forward speed and a yaw rate.
PamojaDhParameters
One joint of a serial arm in the Denavit-Hartenberg convention.
PamojaDiffDrive
A differential drive: two wheels track apart.
PamojaEStop
An opaque handle to a latching emergency stop.
PamojaEsc
An electronic speed controller’s reverse, neutral, and forward pulse widths.
PamojaGuidance
The command toward a waypoint, with the geometry behind it.
PamojaJoints
A two-link arm’s joint angles, in radians.
PamojaLimits
An opaque handle to speed and acceleration limits, with the motion they last allowed.
PamojaMecanum
A mecanum base: four wheels wheelbase front to rear and track side to side.
PamojaOdometry
An opaque handle to a dead-reckoned pose.
PamojaPoint
A point in a plane.
PamojaPose
Where a robot is and which way it faces.
PamojaQuadrature
An opaque handle to a quadrature encoder decoder.
PamojaQuadratureScale
An encoder’s resolution and the radius of the wheel it turns with.
PamojaReach
The closest and farthest a two-link arm’s hand reaches from its shoulder.
PamojaSafetyGate
An opaque handle to the gate every motion command passes through: an e-stop, a watchdog, and limits.
PamojaServoMap
A hobby servo’s pulse range and travel.
PamojaSideSpeeds
The speeds of a two-sided drive’s left and right wheels or tracks.
PamojaSkidSteer
A skid-steer drive: tracks or wheels track apart that slip sideways to turn.
PamojaTransform
A 4x4 homogeneous transform, a rotation and a translation, stored row-major.
PamojaTwist
How fast a robot is asked to move.
PamojaTwoLinkArm
A planar two-link arm: a shoulder link l1 long and an elbow link l2 long.
PamojaWatchdog
An opaque handle to a deadman timer.
PamojaWaypointFollower
Steers toward a waypoint: the speeds and gains of a carrot-following guide.
PamojaWheelSpeeds
The four wheel speeds of a mecanum base.

Enums§

PamojaElbow
Which way a two-link arm’s elbow bends.

Functions§

pamoja_ackermann_curvature
Returns the path curvature of a steering angle, the reciprocal of the turn radius.
pamoja_ackermann_steering_angle
Returns the steering angle for a forward speed and a yaw rate.
pamoja_ackermann_turn_radius
Returns the turn radius of a steering angle.
pamoja_ackermann_yaw_rate
Returns the yaw rate a forward speed and a steering angle produce.
pamoja_dh_transform
Returns the transform one Denavit-Hartenberg joint makes.
pamoja_diff_drive_body_motion
Returns the body motion a differential drive makes from measured wheel speeds.
pamoja_diff_drive_wheel_speeds
Returns the wheel speeds a differential drive needs for a body motion.
pamoja_esc_bidirectional
Returns the common reversible ESC: 1000, 1500, and 2000 microseconds.
pamoja_esc_pulse
Returns the pulse width for a throttle.
pamoja_estop_engage⚠
Engages an e-stop; it holds until reset.
pamoja_estop_free⚠
Releases an e-stop handle.
pamoja_estop_gate⚠
Passes a command through an e-stop.
pamoja_estop_is_engaged⚠
Reports whether an e-stop is engaged.
pamoja_estop_new⚠
Creates an e-stop that is not engaged.
pamoja_estop_reset⚠
Clears an e-stop.
pamoja_forward_kinematics⚠
Returns the transform from a serial arm’s base to its tool.
pamoja_limits_apply⚠
Bounds a command in speed and acceleration.
pamoja_limits_free⚠
Releases a limits handle.
pamoja_limits_new⚠
Creates limits on speed and acceleration, starting from rest.
pamoja_limits_reset⚠
Forgets the motion limits last allowed, so the next command eases up from rest.
pamoja_mecanum_body_motion
Returns the body twist a mecanum base makes from measured wheel speeds.
pamoja_mecanum_wheel_speeds
Returns the four wheel speeds a mecanum base needs for a body twist.
pamoja_obstacle_stop
Cuts forward and sideways motion when an obstacle is within the stopping distance.
pamoja_odometry_free⚠
Releases an odometry handle.
pamoja_odometry_fuse_heading⚠
Nudges an odometry estimate’s heading toward an absolute measurement.
pamoja_odometry_integrate⚠
Integrates a body motion over a time step onto an odometry estimate.
pamoja_odometry_integrate_wheels⚠
Integrates the distances two wheels rolled onto an odometry estimate.
pamoja_odometry_new⚠
Creates an odometry estimate starting from a known pose.
pamoja_odometry_pose⚠
Reads an odometry estimate’s pose.
pamoja_odometry_reset⚠
Sets an odometry estimate to a known pose.
pamoja_quadrature_count⚠
Reads a quadrature decoder’s signed count of steps.
pamoja_quadrature_free⚠
Releases a quadrature decoder handle.
pamoja_quadrature_new⚠
Creates a quadrature decoder seeded with the encoder’s current channel levels.
pamoja_quadrature_reset⚠
Sets a quadrature decoder’s count back to 0, keeping the channel state it last read.
pamoja_quadrature_scale_distance
Returns the distance a wheel rolled for a step count.
pamoja_quadrature_scale_velocity
Returns a wheel’s speed from the steps counted over a time step.
pamoja_quadrature_update⚠
Feeds a quadrature decoder the channel levels it reads now.
pamoja_safety_gate_command⚠
Returns the command that is safe to drive for a desired one over a time step.
pamoja_safety_gate_engage_estop⚠
Engages a safety gate’s latching e-stop.
pamoja_safety_gate_feed⚠
Feeds a safety gate’s watchdog; call it whenever a fresh command arrives.
pamoja_safety_gate_free⚠
Releases a safety gate handle.
pamoja_safety_gate_is_stopped⚠
Reports whether a safety gate is forcing a stop.
pamoja_safety_gate_new⚠
Creates a safety gate from limits and a watchdog timeout.
pamoja_safety_gate_reset_estop⚠
Clears a safety gate’s e-stop.
pamoja_servo_map_angle
Returns the angle a servo pulse width sets.
pamoja_servo_map_pulse
Returns the pulse width that sets a servo to an angle.
pamoja_servo_map_standard
Returns the standard hobby servo: 1000 to 2000 microseconds over 180 degrees.
pamoja_skid_steer_body_motion
Returns the body motion a skid-steer drive makes from measured side speeds.
pamoja_skid_steer_wheel_speeds
Returns the side speeds a skid-steer drive needs for a body motion.
pamoja_transform_identity
Returns the identity transform: no rotation and no translation.
pamoja_transform_multiply
Returns the transform that applies second and then first, their product.
pamoja_two_link_arm_joints_for⚠
Finds the joint angles that put a two-link arm’s hand at a point.
pamoja_two_link_arm_reach
Returns how close and how far a two-link arm reaches.
pamoja_two_link_arm_tip
Returns where a two-link arm’s hand is for its joint angles.
pamoja_watchdog_feed⚠
Feeds a watchdog, restarting its silence timer.
pamoja_watchdog_free⚠
Releases a watchdog handle.
pamoja_watchdog_is_expired⚠
Reports whether a watchdog has expired.
pamoja_watchdog_new⚠
Creates a watchdog that expires after timeout without being fed.
pamoja_watchdog_update⚠
Advances a watchdog’s timer and reports whether it has expired.
pamoja_waypoint_follower_guide
Produces the command from a robot’s position and heading toward a target.