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

LightCast — ray-cast Monte-Carlo localization. More...

Go to the source code of this file.

Namespaces

namespace  light
 Public LightLib odometry / pose-estimation API.
 
namespace  light::lightcast
 

Enumerations

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

Functions

DistanceSensorSpec light::lightcast::fromFace (pros::Distance *s, Face face, float along, float depth)
 Convenience builder — derives angle from face, offsets from (along, depth).
 
void light::lightcast::init (const Pose &initial, const std::vector< DistanceSensorSpec > &sensors, MCLConfig cfg={})
 Initialize the particle filter.
 
void light::lightcast::predict (float dLocalX, float dLocalY, float dTheta)
 Propagate particles by a local-frame arc delta.
 
void light::lightcast::update ()
 Measurement update: read sensors, weight particles, resample.
 
void light::lightcast::startTask ()
 Spawn the 10 Hz LightCast update task.
 
Pose light::lightcast::best ()
 
float light::lightcast::convergence ()
 
bool light::lightcast::converged (float threshold_in=3.0f)
 
int light::lightcast::sensorCount ()
 
std::vector< DistanceSensorSpeclight::lightcast::sensors ()
 
uint32_t light::lightcast::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 light::lightcast::config ()
 
void light::lightcast::setConfig (const MCLConfig &cfg)
 

Detailed Description

LightCast — ray-cast Monte-Carlo localization.

A particle filter driven by distance-sensor ray-casts against the field map. Runs at 10 Hz alongside the 100 Hz EKF. Purpose: give the hybrid fusion a second opinion that the EKF can snap to when the EKF's own covariance blows up (e.g. after a hard wall ram).

Update cadence
  • predict() runs inline from the 100 Hz odom tick to stay synchronized with wheel arc deltas. Cheap (no ray-casts).
  • update() runs from the LightCast task (lightcast.cpp) at 10 Hz — reads distance sensors, computes per-particle likelihoods via field::raycast(), and resamples.

Definition in file lightcast.hpp.