|
Valor 6800 1.0
|
Base class for vision sensors, such as Limelight. More...
#include <VisionSensor.h>
Public Types | |
| enum | PipeLines { PIPELINE_0 , PIPELINE_1 , PIPELINE_2 , PIPELINE_3 , PIPELINE_4 , PIPELINE_5 } |
| Enum representing available pipelines for the vision sensor. | |
Public Member Functions | |
| VisionSensor (frc::TimedRobot &robot, std::string name, frc::Pose3d _cameraPose) | |
| Construct a new VisionSensor object. | |
| void | reset () override |
| Reset the vision sensor state. | |
| void | setCameraPose (frc::Pose3d camPose) |
| Set the camera's pose in 3D space. | |
| void | setPipe (PipeLines _pipe) |
| Set the active pipeline for the vision sensor. | |
| bool | hasTarget () |
| Check if the vision sensor has a valid target. | |
| void | setThrottle (int skippedFrames) |
| void | captureVideo (units::second_t captureTime) |
| Capture video data on the Limelight using Rewind. | |
| units::velocity::meters_per_second_t | getError (int pipe, double kPLimeLight=0.7) |
| Calculate the error for a specific pipeline. | |
Public Member Functions inherited from valor::BaseSensor< frc::Pose3d > | |
| void | setGetter (std::function< frc::Pose3d()> _lambda) |
| Set the lambda function to fetch sensor data. | |
| void | applyPostProcessing (std::function< frc::Pose3d(frc::Pose3d)> func) |
| Set a post-processing function for sensor data. | |
| frc::Pose3d | get () |
| Get the current sensor state. | |
Public Member Functions inherited from valor::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 | setLoggingPeriod (units::millisecond_t period) |
| Set the minimum period between LoggablePeriodic() invocations. | |
| 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 | |
| units::millisecond_t | getTotalLatency () |
| Get the total latency of the vision sensor. | |
| virtual frc::Pose3d | getGlobalPose ()=0 |
| Get the global pose of the vision sensor. | |
| void | calculate () override |
| Perform vision sensor-specific calculations. | |
Protected Member Functions inherited from valor::BaseSensor< frc::Pose3d > | |
| BaseSensor (frc::TimedRobot &robot) | |
| Construct a new BaseSensor object. | |
| virtual void | refresh () |
| Refresh the sensor state. | |
Protected Member Functions inherited from valor::Loggable | |
| Loggable (std::string_view name) | |
| Construct a Loggable that registers a top-level table name. | |
| Loggable () | |
| Default construct an uninitialized Loggable. | |
| virtual | ~Loggable ()=default |
| Virtual destructor. | |
| virtual void | OnLoggingStart () |
| Hook invoked when logging is started for this object. | |
| virtual void | LoggablePeriodic () |
| Periodic callback for logging updates. | |
| template<typename T > | |
| T | WriteLog (std::string_view field, const T &data) |
| 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. | |
Protected Attributes | |
| double | tx |
| double | ty |
| double | tv |
| double | fps |
| double | ramUsage |
| double | ta |
| Vision sensor telemetry data. | |
| int | pipe |
| Active pipeline index. | |
| units::celsius_t | cpuTemp |
| units::celsius_t | temp |
| Temperature readings. | |
| frc::Pose3d | cameraPose |
| Physical 3D position of the camera's lens. | |
| std::shared_ptr< nt::NetworkTable > | limeTable |
| NetworkTable for vision data. | |
Protected Attributes inherited from valor::BaseSensor< frc::Pose3d > | |
| std::function< frc::Pose3d()> | sensorLambda |
| Lambda function to fetch sensor data. | |
| std::function< frc::Pose3d(frc::Pose3d)> | postProcessor |
| Lambda function to post-process sensor data. | |
| frc::Pose3d | prevState |
| Previous and current sensor states. | |
| frc::Pose3d | currState |
| frc::Timer | profiler |
Additional Inherited Members | |
Static Public Member Functions inherited from valor::Loggable | |
| static units::millisecond_t | GetLoggingTime () |
Base class for vision sensors, such as Limelight.
This class provides a framework for managing vision sensors, including fetching pose data, managing pipelines, and calculating latency.
| valor::VisionSensor::VisionSensor | ( | frc::TimedRobot & | robot, |
| std::string | name, | ||
| frc::Pose3d | _cameraPose ) |
Construct a new VisionSensor object.
| robot | Reference to the robot, used to schedule the calculate method. |
| name | Hostname of the vision sensor (e.g., Limelight). |
| _cameraPose | Physical 3D position of the camera's lens. |
|
overrideprotectedvirtual |
Perform vision sensor-specific calculations.
This method is called every 10ms and processes the sensor data fetched by the lambda function.
Implements valor::BaseSensor< frc::Pose3d >.
| void valor::VisionSensor::captureVideo | ( | units::second_t | captureTime | ) |
Capture video data on the Limelight using Rewind.
| captureTime | The amount of past time to capture in the video |
| units::velocity::meters_per_second_t valor::VisionSensor::getError | ( | int | pipe, |
| double | kPLimeLight = 0.7 ) |
Calculate the error for a specific pipeline.
| pipe | The pipeline to calculate the error for. |
| kPLimeLight | Proportional constant for error calculation. |
|
protectedpure virtual |
Get the global pose of the vision sensor.
This method must be implemented in derived classes to calculate the global pose based on the sensor's data.
Implemented in valor::GamePieceSensor.
|
protected |
Get the total latency of the vision sensor.
| bool valor::VisionSensor::hasTarget | ( | ) |
Check if the vision sensor has a valid target.
|
overridevirtual |
Reset the vision sensor state.
Reimplemented from valor::BaseSensor< frc::Pose3d >.
| void valor::VisionSensor::setCameraPose | ( | frc::Pose3d | camPose | ) |
Set the camera's pose in 3D space.
| camPose | The new camera pose. |
Set the active pipeline for the vision sensor.
| _pipe | The pipeline to activate. |