LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
light::lightcast Namespace Reference

Functions

void init (const Pose &initial, const std::vector< DistanceSensorSpec > &sensors, MCLConfig cfg={})
 Initialize the particle filter.
 
void predict (float dLocalX, float dLocalY, float dTheta)
 Propagate particles by a local-frame arc delta.
 
void update ()
 Measurement update: read sensors, weight particles, resample.
 
void startTask ()
 Spawn the 10 Hz LightCast update task.
 
Pose best ()
 
float convergence ()
 
bool converged (float threshold_in=3.0f)
 
int sensorCount ()
 
std::vector< DistanceSensorSpecsensors ()
 
uint32_t degenerateTickCount ()
 Number of ticks where the filter saw all-degenerate weights and reset to uniform (motion-model only).
 
Live tuning

Mirrors the EKF API so the autotune routine and on-brain tuner can push noise constants without reinitializing the filter.

MCLConfig config ()
 
void setConfig (const MCLConfig &cfg)
 

Function Documentation

◆ best()

Pose light::lightcast::best ( )
Returns
The current best-estimate pose (highest-weight particle / mean).

◆ config()

MCLConfig light::lightcast::config ( )

◆ converged()

bool light::lightcast::converged ( float  threshold_in = 3.0f)
Returns
true if convergence() < threshold_in.

◆ convergence()

float light::lightcast::convergence ( )
Returns
The standard deviation of the particle cloud, inches.

◆ degenerateTickCount()

uint32_t light::lightcast::degenerateTickCount ( )

Number of ticks where the filter saw all-degenerate weights and reset to uniform (motion-model only).

Increments without printing — caller can poll on its own schedule for diagnostics.

◆ init()

void light::lightcast::init ( const Pose initial,
const std::vector< DistanceSensorSpec > &  sensors,
MCLConfig  cfg = {} 
)

Initialize the particle filter.

Parameters
initialstarting pose
sensorslist of distance-sensor specs
cfgtuning constants

◆ predict()

void light::lightcast::predict ( float  dLocalX,
float  dLocalY,
float  dTheta 
)

Propagate particles by a local-frame arc delta.

Cheap, no ray-casts.

◆ sensorCount()

int light::lightcast::sensorCount ( )
Returns
Number of distance sensors registered.

◆ sensors()

std::vector< DistanceSensorSpec > light::lightcast::sensors ( )
Returns
The registered sensor specs.

◆ setConfig()

void light::lightcast::setConfig ( const MCLConfig cfg)

◆ startTask()

void light::lightcast::startTask ( )

Spawn the 10 Hz LightCast update task.

Call after init().

◆ update()

void light::lightcast::update ( )

Measurement update: read sensors, weight particles, resample.