Valkyrie 2026
Loading...
Searching...
No Matches
valor::sensors::LidarSensor Class Reference

Specific implementation of the Lidar Sensor for Grapple Robotics LidarCAN device. More...

#include <valkyrie/sensors/LidarSensor.h>

Inheritance diagram for valor::sensors::LidarSensor:
valor::sensors::BaseSensor< units::millimeter_t > valor::sensors::BaseSensorCore valor::Loggable valor::sensors::LaserProximitySensor valor::sensors::CANrangeSensor valor::sensors::GrappleSensor

Classes

struct  SimState

Public Member Functions

 LidarSensor ()
 Construct a new LidarSensor object.
void SetMaxDistance (units::millimeter_t dist)
units::millimeter_t GetMaxDistance () const
void SetDefaultDistance (units::millimeter_t dist)
units::millimeter_t GetDefaultDistance () const
virtual bool IsHealthy () const
 Represents whether the sensor data is healthy.
void SetupSim (std::function< frc::Pose2d()> robotPoseGetter, frc::Transform2d sensorPosition, std::vector< sim::FieldFeature > features)
void SetGetter (std::function< units::millimeter_t()> getter)
void LoggablePeriodic () override
 Periodic callback for logging updates.
Public Member Functions inherited from valor::sensors::BaseSensor< units::millimeter_t >
virtual void Reset ()
 Reset the sensor state.
void SetGetter (std::function< units::millimeter_t()> _lambda)
 Set the lambda function to fetch sensor data.
void ApplyPostProcessing (std::function< units::millimeter_t(units::millimeter_t)> func)
 Set a post-processing function for sensor data.
units::millimeter_t Get () const
 Get the current sensor state.
void Refresh () override
 Refresh the sensor state.
Public Member Functions inherited from valor::sensors::BaseSensorCore
virtual void Calculate ()
Public Member Functions inherited from valor::Loggable
 Loggable (std::string_view name)
 Construct a Loggable that registers a top-level table name.
 Loggable (std::shared_ptr< nt::NetworkTable > table)
 Construct a Loggable that uses an existing NetworkTable.
 Loggable ()=default
 Default construct an uninitialized Loggable.
void LogChild (std::string_view name, Loggable *child)
 Register a child Loggable under a named subtree.
void LogChild (std::string_view name, wpi::Sendable *child)
 Register a child Sendable under a named subtree.
bool WriteLog (std::string_view field, bool data)
double WriteLog (std::string_view field, double data)
void WriteLog (std::string_view field, const std::vector< double > &data)
template<typename U>
requires units::traits::is_unit_t_v<U>
U WriteLog (std::string_view field, U data)
void WriteLog (std::string_view field, std::string_view data)
template<typename E>
requires std::is_enum_v<E>
void WriteLog (std::string_view field, E data)
template<typename T>
requires wpi::StructSerializable<T> && (!std::is_arithmetic_v<T>)
void WriteLog (std::string_view field, const T &data)
template<typename T>
requires wpi::StructSerializable<T> && (!std::is_arithmetic_v<T>)
void WriteLog (std::string_view field, const std::vector< T > &data)
bool ReadLog (std::string_view field, bool defaultValue)
double ReadLog (std::string_view field, double defaultValue)
template<typename U>
requires units::traits::is_unit_t_v<U>
U ReadLog (std::string_view field, U defaultValue)

Protected Attributes

std::unique_ptr< SimState > simState
Protected Attributes inherited from valor::sensors::BaseSensor< units::millimeter_t >
std::function< units::millimeter_t()> sensorLambda
 Lambda function to fetch sensor data.
std::function< units::millimeter_t(units::millimeter_t)> postProcessor
 Lambda function to post-process sensor data.
units::millimeter_t prevState
 Previous and current sensor states.
units::millimeter_t currState

Additional Inherited Members

Static Public Member Functions inherited from valor::Loggable
static constexpr Loggable & GetRoot ()
Static Public Attributes inherited from valor::sensors::BaseSensorCore
static constexpr units::millisecond_t LOOP_PERIOD = frc::TimedRobot::kDefaultPeriod / 2
Protected Member Functions inherited from valor::Loggable
virtual void OnLoggingStart ()
 Hook invoked when logging is started for this object.

Detailed Description

Specific implementation of the Lidar Sensor for Grapple Robotics LidarCAN device.

This class extends the BaseSensor class and provides functionality specific to the Lidar sensor. It allows for fetching distance measurements and setting a maximum distance threshold.

Constructor & Destructor Documentation

◆ LidarSensor()

valor::sensors::LidarSensor::LidarSensor ( )

Construct a new LidarSensor object.

Parameters
robotReference to the robot, used to schedule the calculate method.

Member Function Documentation

◆ IsHealthy()

virtual bool valor::sensors::LidarSensor::IsHealthy ( ) const
inlinevirtual

Represents whether the sensor data is healthy.

If the data is not healthy, LidarSensor will return the default distance instead of the sensor's getter

Reimplemented in valor::sensors::CANrangeSensor, and valor::sensors::GrappleSensor.

◆ LoggablePeriodic()

void valor::sensors::LidarSensor::LoggablePeriodic ( )
overridevirtual

Periodic callback for logging updates.

If a derived class needs to perform periodic updates to published values, override this method. It is intended to be called by the logging framework; this base class provides an empty implementation.

Reimplemented from valor::Loggable.


The documentation for this class was generated from the following file: