|
Valkyrie 2026
|
Specific implementation of the Lidar Sensor for Grapple Robotics LidarCAN device. More...
#include <valkyrie/sensors/LidarSensor.h>
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) |
| 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::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 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. | |
| void | SetPeriodicLevel (LogLevel level) |
| Set the logging level for LoggablePeriodic. | |
| template<typename T> | |
| T | WriteLog (std::string_view field, const T &data, LogLevel level=LogLevel::Normal) |
| Publish a value to NetworkTables under the given field. | |
| template<typename T> | |
| T | ReadLog (std::string_view field, const T &defaultValue={}) |
| Read a value from NetworkTables for the given field. | |
| template<> | |
| decltype(Loggable::subscribers) ::iterator | addSubscriber (std::string_view field, const std::vector< bool > &defaultValue) |
| template<> | |
| void | WriteLogImpl (nt::Publisher *pub, const std::vector< bool > &data) |
| template<> | |
| std::vector< bool > | ReadLogImpl (nt::Subscriber *sub) |
Protected Member Functions | |
| void | Calculate () override |
| Perform Lidar-specific calculations. | |
| Protected Member Functions inherited from valor::Loggable | |
| virtual void | OnLoggingStart () |
| Hook invoked when logging is started for this object. | |
| virtual void | LoggablePeriodic () |
| Periodic callback for logging updates. | |
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 units::millisecond_t | GetLoggingTime () |
| static constexpr Loggable & | GetRoot () |
| Static Public Attributes inherited from valor::sensors::BaseSensorCore | |
| static constexpr units::millisecond_t | LOOP_PERIOD = frc::TimedRobot::kDefaultPeriod / 2 |
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.
| valor::sensors::LidarSensor::LidarSensor | ( | ) |
Construct a new LidarSensor object.
| robot | Reference to the robot, used to schedule the calculate method. |
|
overrideprotectedvirtual |
Perform Lidar-specific calculations.
This method is called every 10ms and processes the sensor data fetched by the lambda function.
Reimplemented from valor::sensors::BaseSensorCore.
|
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.