Table of Contents

Class Kit

Namespace
Pamoja.Kit
Assembly
Pamoja.Kit.dll

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

int

Methods

BearingBetween(Coordinate, Coordinate)

Returns the initial bearing from one coordinate to another.

public static double BearingBetween(Coordinate origin, Coordinate destination)

Parameters

origin Coordinate

The coordinate to measure from.

destination Coordinate

The 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

value float

The latest reading.

center float

The value the band sits around.

width float

How far the band reaches either side of center; its magnitude is used.

Returns

float

center while the reading is within width of 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

celsius double

The air temperature, in degrees Celsius.

humidityPercent double

The 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

origin Coordinate

The coordinate to measure from.

destination Coordinate

The 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

joints DhParameters[]

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

twist Twist

The requested motion.

rangeM float

The nearest range ahead, in meters; one that is not a number counts as an obstacle.

stopDistanceM float

The range at or below which motion is cut; its magnitude is used.

Returns

Twist

twist while 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

ax double

Acceleration along the forward axis, in any unit.

ay double

Acceleration along the right axis, in the same unit.

az double

Acceleration along the up axis, in the same unit.

Returns

Tilt

The tilt in degrees; only the ratios between axes set it.