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

Enumerations

enum class  Face { FRONT , BACK , LEFT , RIGHT }
 Robot-frame face that a distance sensor is mounted on. More...
 

Functions

DistanceSensorSpec fromFace (pros::Distance *s, Face face, float along, float depth)
 Convenience builder — derives angle from face, offsets from (along, depth).
 
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)
 

Enumeration Type Documentation

◆ Face

enum class light::lightcast::Face
strong

Robot-frame face that a distance sensor is mounted on.

Enumerator
FRONT 
BACK 
LEFT 
RIGHT 

Definition at line 27 of file lightcast.hpp.

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.

◆ fromFace()

DistanceSensorSpec light::lightcast::fromFace ( pros::Distance *  s,
Face  face,
float  along,
float  depth 
)

Convenience builder — derives angle from face, offsets from (along, depth).

Parameters
sthe PROS distance sensor (pointer, not owned)
facewhich face the sensor is mounted on
alongposition along the face, robot-frame signed (LEFT/RIGHT +/-)
depthdistance from robot center perpendicular to the face (always positive)

Raw DistanceSensorSpec (in odometry.hpp) stays exposed for diagonal mounts.

◆ 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.