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

Specific implementation of the LaserProximitySensor for Grapple Robotics. More...

#include <valkyrie/sensors/GrappleSensor.h>

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

Public Member Functions

 GrappleSensor (int canID)
 Construct a new GrappleSensor object.
bool IsHealthy () const override
 Represents whether the sensor data is healthy.
Public Member Functions inherited from valor::sensors::LaserProximitySensor
 LaserProximitySensor ()
 Construct a new LaserProximitySensor object.
void SetThresholdDistance (units::millimeter_t threshold)
 Set the threshold distance for triggering the sensor.
units::millimeter_t GetThresholdDistance () const
 Returns the threshold distance for triggering the sensor.
void Reset () override
 Reset the sensor state, including Lidar and debounce logic.
LaserProximityData Get ()
 Get the current sensor data.
void SetGetter (std::function< units::millimeter_t()> getter)
 Set the getter function for the Lidar sensor.
Public Member Functions inherited from valor::sensors::BaseSensor< LaserProximityData >
void SetGetter (std::function< LaserProximityData()> _lambda)
 Set the lambda function to fetch sensor data.
void ApplyPostProcessing (std::function< LaserProximityData(LaserProximityData)> func)
 Set a post-processing function for sensor data.
LaserProximityData Get () const
 Get the current 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>
WriteLog (std::string_view field, const T &data, LogLevel level=LogLevel::Normal)
 Publish a value to NetworkTables under the given field.
template<typename 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)
Public Member Functions inherited from valor::sensors::LidarSensor
 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
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 >
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.
Public Member Functions inherited from valor::sensors::DebounceSensor
 DebounceSensor ()
 Construct a new DebounceSensor object.
void SetEdgeCallback (std::function< void()> lambda)
 Set a callback function for detecting any edge (rising or falling).
void SetRisingEdgeCallback (std::function< void()> lambda)
 Set a callback function for detecting a rising edge.
void SetFallingEdgeCallback (std::function< void()> lambda)
 Set a callback function for detecting a falling edge.
Public Member Functions inherited from valor::sensors::BaseSensor< bool >
void SetGetter (std::function< bool()> _lambda)
 Set the lambda function to fetch sensor data.
void ApplyPostProcessing (std::function< bool(bool)> func)
 Set a post-processing function for sensor data.
bool Get () const
 Get the current sensor state.

Additional Inherited Members

Static Public Member Functions inherited from valor::Loggable
static units::millisecond_t GetLoggingTime ()
static constexpr LoggableGetRoot ()
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::sensors::LaserProximitySensor
void Calculate () override
 Perform proximity sensor-specific calculations.
void Refresh () override
 Refresh the sensor state.
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 Member Functions inherited from valor::sensors::LidarSensor
void Calculate () override
 Perform Lidar-specific calculations.
Protected Attributes inherited from valor::sensors::BaseSensor< LaserProximityData >
std::function< LaserProximityData()> sensorLambda
 Lambda function to fetch sensor data.
std::function< LaserProximityData(LaserProximityData)> postProcessor
 Lambda function to post-process sensor data.
LaserProximityData prevState
 Previous and current sensor states.
LaserProximityData currState
Protected Attributes inherited from valor::sensors::LidarSensor
std::unique_ptr< SimStatesimState
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
Protected Attributes inherited from valor::sensors::BaseSensor< bool >
std::function< bool()> sensorLambda
 Lambda function to fetch sensor data.
std::function< bool(bool)> postProcessor
 Lambda function to post-process sensor data.
bool prevState
 Previous and current sensor states.
bool currState

Detailed Description

Specific implementation of the LaserProximitySensor for Grapple Robotics.

This class integrates the Grapple Robotics LidarCAN device with the LaserProximitySensor framework, providing additional functionality specific to the Grapple sensor.

Constructor & Destructor Documentation

◆ GrappleSensor()

valor::sensors::GrappleSensor::GrappleSensor ( int canID)

Construct a new GrappleSensor object.

Parameters
robotReference to the robot, used to schedule the calculate method.
canIdCAN ID of the Grapple sensor device.

Member Function Documentation

◆ IsHealthy()

bool valor::sensors::GrappleSensor::IsHealthy ( ) const
overridevirtual

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 from valor::sensors::LidarSensor.


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