Class Kit
The stateless helpers from the pamoja kit.
public static class Kit
- Inheritance
-
Kit
- Inherited Members
Remarks
The stateful helpers are their own types (Smoother, Pid, Thermostat and the rest); what remains here is the arithmetic that needs no memory of previous calls.
Fields
WindowCapacity
The most readings a windowed helper (Window, Median, Trend, Anomaly) keeps, and the number it keeps unless told fewer.
public const int WindowCapacity = 32
Field Value
Methods
BearingBetween(Coordinate, Coordinate)
Returns the initial bearing from one coordinate to another.
public static double BearingBetween(Coordinate origin, Coordinate destination)
Parameters
originCoordinateThe coordinate to measure from.
destinationCoordinateThe coordinate to measure to.
Returns
- double
The bearing in degrees, clockwise from north.
Deadband(float, float, float)
Holds a reading at the center while it stays within the band, so small wiggle does not act.
public static float Deadband(float value, float center, float width)
Parameters
valuefloatThe latest reading.
centerfloatThe value the band sits around.
widthfloatHow far the band reaches either side of
center; its magnitude is used.
Returns
- float
centerwhile the reading is withinwidthof it, and otherwise the reading unchanged.
DewPoint(double, double)
Computes the dew point from the air temperature and relative humidity.
public static double DewPoint(double celsius, double humidityPercent)
Parameters
celsiusdoubleThe air temperature, in degrees Celsius.
humidityPercentdoubleThe relative humidity, in percent.
Returns
- double
The dew point, in degrees Celsius.
DistanceBetween(Coordinate, Coordinate)
Returns the great-circle distance between two coordinates.
public static double DistanceBetween(Coordinate origin, Coordinate destination)
Parameters
originCoordinateThe coordinate to measure from.
destinationCoordinateThe coordinate to measure to.
Returns
- double
The distance in meters.
ForwardKinematics(params DhParameters[])
Returns the transform from a serial arm's base to its tool.
public static Transform ForwardKinematics(params DhParameters[] joints)
Parameters
jointsDhParameters[]The arm's joints, base first.
Returns
- Transform
The composed transform, or the identity for an arm with no joints.
ObstacleStop(Twist, float, float)
Cuts forward and sideways motion when an obstacle is within the stopping distance, keeping the turn.
public static Twist ObstacleStop(Twist twist, float rangeM, float stopDistanceM)
Parameters
twistTwistThe requested motion.
rangeMfloatThe nearest range ahead, in meters; one that is not a number counts as an obstacle.
stopDistanceMfloatThe range at or below which motion is cut; its magnitude is used.
Returns
- Twist
twistwhile the way is clear, or it with no forward or sideways speed.
TiltFromAccel(double, double, double)
Computes roll and pitch from a three-axis accelerometer at rest.
public static Tilt TiltFromAccel(double ax, double ay, double az)
Parameters
axdoubleAcceleration along the forward axis, in any unit.
aydoubleAcceleration along the right axis, in the same unit.
azdoubleAcceleration along the up axis, in the same unit.
Returns
- Tilt
The tilt in degrees; only the ratios between axes set it.