|
Brick
|
#include <rotation.h>
Class implementing the V5 Rotation Sensor.
Provides functions for getting angle (wrapped), position (continuous), and angular velocity. The sensor is able to be reversed, and its position can be set.
Public Member Functions | |
| Rotation (int port, bool reversed=false) | |
| Constructs a Rotation Sensor. | |
| Rotation2d | angle () const |
| Gets the shaft's absolute orientation within one revolution. | |
| units::Angle | position () const |
| Gets the shaft's accumulated rotation relative to the current zero point. | |
| units::AngularVelocity | velocity () const |
| Gets the shaft's angular velocity. | |
| void | set_position (units::Angle position) |
| Sets the accumulated position to a continuous units::Angle. | |
| void | set_position (Rotation2d position) |
| Sets the accumulated position to a wrapped Rotation2d. | |
| void | reset_position () |
| Sets the accumulated position to zero. | |
| void | set_reversed (bool reversed) |
| Configures the direction reported. | |
| bool | reversed () const |
| Gets the sensor's reversal flag. | |
| Public Member Functions inherited from crust::Device | |
| int | port () const |
| Gets the physical Smart Port number. | |
| bool | installed () const |
| Checks whether the expected device is currently connected. | |
Additional Inherited Members | |
| Protected Member Functions inherited from crust::Device | |
| Device (int port, int expected_type) | |
| Resolves and caches the C SDK handle for a physical Smart Port. | |
| ~Device ()=default | |
| Destroys the device. | |
| _V5_Device * | handle () const |
| Provides the device handle associated with this port. | |
|
explicit |
Constructs a Rotation Sensor.
| port | Physical Smart Port number [1, 21]. |
| reversed | True to reverse the reported direction. |
| Rotation2d crust::Rotation::angle | ( | ) | const |
Gets the shaft's absolute orientation within one revolution.
| units::Angle crust::Rotation::position | ( | ) | const |
Gets the shaft's accumulated rotation relative to the current zero point.
| void crust::Rotation::reset_position | ( | ) |
Sets the accumulated position to zero.
| bool crust::Rotation::reversed | ( | ) | const |
Gets the sensor's reversal flag.
| void crust::Rotation::set_position | ( | Rotation2d | position | ) |
Sets the accumulated position to a wrapped Rotation2d.
| position | value to set. |
| void crust::Rotation::set_position | ( | units::Angle | position | ) |
Sets the accumulated position to a continuous units::Angle.
| position | value to set. |
| void crust::Rotation::set_reversed | ( | bool | reversed | ) |
Configures the direction reported.
| reversed | True to reverse the sensor. |
| units::AngularVelocity crust::Rotation::velocity | ( | ) | const |
Gets the shaft's angular velocity.