[docs] Add missing JavaDocs (#6125)

This commit is contained in:
Tyler Veness
2024-01-01 22:56:23 -08:00
committed by GitHub
parent 5579219716
commit ad0859a8c9
137 changed files with 1202 additions and 204 deletions

View File

@@ -56,23 +56,47 @@ namespace frc {
class ADIS16448_IMU : public wpi::Sendable,
public wpi::SendableHelper<ADIS16448_IMU> {
public:
/* ADIS16448 Calibration Time Enum Class */
/**
* ADIS16448 calibration times.
*/
enum class CalibrationTime {
/// 32 ms calibration time.
_32ms = 0,
/// 64 ms calibration time.
_64ms = 1,
/// 128 ms calibration time.
_128ms = 2,
/// 256 ms calibration time.
_256ms = 3,
/// 512 ms calibration time.
_512ms = 4,
/// 1 s calibration time.
_1s = 5,
/// 2 s calibration time.
_2s = 6,
/// 4 s calibration time.
_4s = 7,
/// 8 s calibration time.
_8s = 8,
/// 16 s calibration time.
_16s = 9,
/// 32 s calibration time.
_32s = 10,
/// 64 s calibration time.
_64s = 11
};
enum IMUAxis { kX, kY, kZ };
/**
* IMU axes.
*/
enum IMUAxis {
/// The IMU's X axis.
kX,
/// The IMU's Y axis.
kY,
/// The IMU's Z axis.
kZ
};
/**
* IMU constructor on onboard MXP CS0, Z-up orientation, and complementary
@@ -183,31 +207,71 @@ class ADIS16448_IMU : public wpi::Sendable,
*/
units::meters_per_second_squared_t GetAccelZ() const;
/**
* Returns the complementary angle around the X axis computed from
* accelerometer and gyro rate measurements.
*/
units::degree_t GetXComplementaryAngle() const;
/**
* Returns the complementary angle around the Y axis computed from
* accelerometer and gyro rate measurements.
*/
units::degree_t GetYComplementaryAngle() const;
/**
* Returns the X-axis filtered acceleration angle.
*/
units::degree_t GetXFilteredAccelAngle() const;
/**
* Returns the Y-axis filtered acceleration angle.
*/
units::degree_t GetYFilteredAccelAngle() const;
/**
* Returns the magnetic field strength in the X axis.
*/
units::tesla_t GetMagneticFieldX() const;
/**
* Returns the magnetic field strength in the Y axis.
*/
units::tesla_t GetMagneticFieldY() const;
/**
* Returns the magnetic field strength in the Z axis.
*/
units::tesla_t GetMagneticFieldZ() const;
/**
* Returns the barometric pressure.
*/
units::pounds_per_square_inch_t GetBarometricPressure() const;
/**
* Returns the temperature.
*/
units::celsius_t GetTemperature() const;
IMUAxis GetYawAxis() const;
int SetYawAxis(IMUAxis yaw_axis);
/**
* Checks the connection status of the IMU.
*
* @return True if the IMU is connected, false otherwise.
*/
bool IsConnected() const;
int ConfigDecRate(uint16_t DecimationRate);
/**
* Configures the decimation rate of the IMU.
*
* @param decimationRate The new decimation value.
* @return 0 if success, 1 if no change, 2 if error.
*/
int ConfigDecRate(uint16_t decimationRate);
/**
* Get the SPI port number.

View File

@@ -53,27 +53,93 @@ namespace frc {
class ADIS16470_IMU : public wpi::Sendable,
public wpi::SendableHelper<ADIS16470_IMU> {
public:
/* ADIS16470 Calibration Time Enum Class */
/**
* ADIS16470 calibration times.
*/
enum class CalibrationTime {
/// 32 ms calibration time.
_32ms = 0,
/// 64 ms calibration time.
_64ms = 1,
/// 128 ms calibration time.
_128ms = 2,
/// 256 ms calibration time.
_256ms = 3,
/// 512 ms calibration time.
_512ms = 4,
/// 1 s calibration time.
_1s = 5,
/// 2 s calibration time.
_2s = 6,
/// 4 s calibration time.
_4s = 7,
/// 8 s calibration time.
_8s = 8,
/// 16 s calibration time.
_16s = 9,
/// 32 s calibration time.
_32s = 10,
/// 64 s calibration time.
_64s = 11
};
enum IMUAxis { kX, kY, kZ, kYaw, kPitch, kRoll };
/**
* IMU axes.
*
* kX, kY, and kZ refer to the IMU's X, Y, and Z axes respectively. kYaw,
* kPitch, and kRoll are configured by the user to refer to an X, Y, or Z
* axis.
*/
enum IMUAxis {
/// The IMU's X axis.
kX,
/// The IMU's Y axis.
kY,
/// The IMU's Z axis.
kZ,
/// The user-configured yaw axis.
kYaw,
/// The user-configured pitch axis.
kPitch,
/// The user-configured roll axis.
kRoll
};
/**
* Creates a new ADIS16740 IMU object.
*
* The default setup is the onboard SPI port with a calibration time of 4
* seconds. Yaw, pitch, and roll are kZ, kX, and kY respectively.
*/
ADIS16470_IMU();
/**
* Creates a new ADIS16740 IMU object.
*
* The default setup is the onboard SPI port with a calibration time of 4
* seconds.
*
* <b><i>Input axes limited to kX, kY and kZ. Specifying kYaw, kPitch,or kRoll
* will result in an error.</i></b>
*
* @param yaw_axis The axis that measures the yaw
* @param pitch_axis The axis that measures the pitch
* @param roll_axis The axis that measures the roll
*/
ADIS16470_IMU(IMUAxis yaw_axis, IMUAxis pitch_axis, IMUAxis roll_axis);
/**
* Creates a new ADIS16740 IMU object.
*
* <b><i>Input axes limited to kX, kY and kZ. Specifying kYaw, kPitch, or
* kRoll will result in an error.</i></b>
*
* @param yaw_axis The axis that measures the yaw
* @param pitch_axis The axis that measures the pitch
* @param roll_axis The axis that measures the roll
* @param port The SPI Port the gyro is plugged into
* @param cal_time Calibration time
*/
explicit ADIS16470_IMU(IMUAxis yaw_axis, IMUAxis pitch_axis,
IMUAxis roll_axis, frc::SPI::Port port,
CalibrationTime cal_time);
@@ -84,9 +150,12 @@ class ADIS16470_IMU : public wpi::Sendable,
ADIS16470_IMU& operator=(ADIS16470_IMU&&) = default;
/**
* @brief Configures the decimation rate of the IMU.
* Configures the decimation rate of the IMU.
*
* @param decimationRate The new decimation value.
* @return 0 if success, 1 if no change, 2 if error.
*/
int ConfigDecRate(uint16_t reg);
int ConfigDecRate(uint16_t decimationRate);
/**
* @brief Switches the active SPI port to standard SPI mode, writes the
@@ -101,8 +170,11 @@ class ADIS16470_IMU : public wpi::Sendable,
int ConfigCalTime(CalibrationTime new_cal_time);
/**
* @brief Resets the gyro accumulations to a heading of zero. This can be used
* if the "zero" orientation of the sensor needs to be changed in runtime.
* Reset the gyro.
*
* Resets the gyro accumulations to a heading of zero. This can be used if
* there is significant drift in the gyro and it needs to be recalibrated
* after running.
*/
void Reset();
@@ -144,14 +216,18 @@ class ADIS16470_IMU : public wpi::Sendable,
void SetGyroAngleZ(units::degree_t angle);
/**
* @param axis The IMUAxis whose angle to return
* @return The axis angle (CCW positive)
* Returns the axis angle (CCW positive).
*
* @param axis The IMUAxis whose angle to return.
* @return The axis angle (CCW positive).
*/
units::degree_t GetAngle(IMUAxis axis) const;
/**
* @param axis The IMUAxis whose rate to return
* @return Axis angular rate (CCW positive)
* Returns the axis angular rate (CCW positive).
*
* @param axis The IMUAxis whose rate to return.
* @return Axis angular rate (CCW positive).
*/
units::degrees_per_second_t GetRate(IMUAxis axis) const;

View File

@@ -26,14 +26,42 @@ namespace frc {
class ADXL345_I2C : public nt::NTSendable,
public wpi::SendableHelper<ADXL345_I2C> {
public:
enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 };
/**
* Accelerometer range.
*/
enum Range {
/// 2 Gs max.
kRange_2G = 0,
/// 4 Gs max.
kRange_4G = 1,
/// 8 Gs max.
kRange_8G = 2,
/// 16 Gs max.
kRange_16G = 3
};
enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
/**
* Accelerometer axes.
*/
enum Axes {
/// X axis.
kAxis_X = 0x00,
/// Y axis.
kAxis_Y = 0x02,
/// Z axis.
kAxis_Z = 0x04
};
/**
* Container type for accelerations from all axes.
*/
struct AllAxes {
double XAxis;
double YAxis;
double ZAxis;
/// Acceleration along the X axis in g-forces.
double XAxis = 0.0;
/// Acceleration along the Y axis in g-forces.
double YAxis = 0.0;
/// Acceleration along the Z axis in g-forces.
double ZAxis = 0.0;
};
/**

View File

@@ -21,14 +21,42 @@ namespace frc {
class ADXL345_SPI : public nt::NTSendable,
public wpi::SendableHelper<ADXL345_SPI> {
public:
enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 };
/**
* Accelerometer range.
*/
enum Range {
/// 2 Gs max.
kRange_2G = 0,
/// 4 Gs max.
kRange_4G = 1,
/// 8 Gs max.
kRange_8G = 2,
/// 16 Gs max.
kRange_16G = 3
};
enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
/**
* Accelerometer axes.
*/
enum Axes {
/// X axis.
kAxis_X = 0x00,
/// Y axis.
kAxis_Y = 0x02,
/// Z axis.
kAxis_Z = 0x04
};
/**
* Container type for accelerations from all axes.
*/
struct AllAxes {
double XAxis;
double YAxis;
double ZAxis;
/// Acceleration along the X axis in g-forces.
double XAxis = 0.0;
/// Acceleration along the Y axis in g-forces.
double YAxis = 0.0;
/// Acceleration along the Z axis in g-forces.
double ZAxis = 0.0;
};
/**

View File

@@ -19,13 +19,40 @@ namespace frc {
*/
class ADXL362 : public nt::NTSendable, public wpi::SendableHelper<ADXL362> {
public:
enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2 };
/**
* Accelerometer range.
*/
enum Range {
/// 2 Gs max.
kRange_2G = 0,
/// 4 Gs max.
kRange_4G = 1,
/// 8 Gs max.
kRange_8G = 2
};
enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
/**
* Accelerometer axes.
*/
enum Axes {
/// X axis.
kAxis_X = 0x00,
/// Y axis.
kAxis_Y = 0x02,
/// Z axis.
kAxis_Z = 0x04
};
/**
* Container type for accelerations from all axes.
*/
struct AllAxes {
double XAxis;
double YAxis;
double ZAxis;
/// Acceleration along the X axis in g-forces.
double XAxis = 0.0;
/// Acceleration along the Y axis in g-forces.
double YAxis = 0.0;
/// Acceleration along the Z axis in g-forces.
double ZAxis = 0.0;
};
public:

View File

@@ -33,14 +33,14 @@ class AnalogOutput : public wpi::Sendable,
/**
* Set the value of the analog output.
*
* @param voltage The output value in Volts, from 0.0 to +5.0
* @param voltage The output value in Volts, from 0.0 to +5.0.
*/
void SetVoltage(double voltage);
/**
* Get the voltage of the analog output
* Get the voltage of the analog output.
*
* @return The value in Volts, from 0.0 to +5.0
* @return The value in Volts, from 0.0 to +5.0.
*/
double GetVoltage() const;

View File

@@ -6,10 +6,15 @@
namespace frc {
/** Defines the state in which the AnalogTrigger triggers. */
enum class AnalogTriggerType {
/// In window.
kInWindow = 0,
/// State.
kState = 1,
/// Rising Pulse.
kRisingPulse = 2,
/// Falling pulse.
kFallingPulse = 3
};

View File

@@ -17,7 +17,17 @@ namespace frc {
class BuiltInAccelerometer : public wpi::Sendable,
public wpi::SendableHelper<BuiltInAccelerometer> {
public:
enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2 };
/**
* Accelerometer range.
*/
enum Range {
/// 2 Gs max.
kRange_2G = 0,
/// 4 Gs max.
kRange_4G = 1,
/// 8 Gs max.
kRange_8G = 2
};
/**
* Constructor.

View File

@@ -426,25 +426,43 @@ class XboxController : public GenericHID {
*/
BooleanEvent RightTrigger(EventLoop* loop) const;
/** Represents a digital button on an XboxController. */
struct Button {
/// Left bumper.
static constexpr int kLeftBumper = 5;
/// Right bumper.
static constexpr int kRightBumper = 6;
/// Left stick.
static constexpr int kLeftStick = 9;
/// Right stick.
static constexpr int kRightStick = 10;
/// A.
static constexpr int kA = 1;
/// B.
static constexpr int kB = 2;
/// X.
static constexpr int kX = 3;
/// Y.
static constexpr int kY = 4;
/// Back.
static constexpr int kBack = 7;
/// Start.
static constexpr int kStart = 8;
};
/** Represents an axis on an XboxController. */
struct Axis {
/// Left X.
static constexpr int kLeftX = 0;
/// Right X.
static constexpr int kRightX = 4;
/// Left Y.
static constexpr int kLeftY = 1;
/// Right Y.
static constexpr int kRightY = 5;
/// Left trigger.
static constexpr int kLeftTrigger = 2;
/// Right trigger.
static constexpr int kRightTrigger = 3;
};
};

View File

@@ -20,7 +20,27 @@ class [[deprecated(
Accelerometer(Accelerometer&&) = default;
Accelerometer& operator=(Accelerometer&&) = default;
enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 };
/**
* Accelerometer range.
*/
enum Range {
/**
* 2 Gs max.
*/
kRange_2G = 0,
/**
* 4 Gs max.
*/
kRange_4G = 1,
/**
* 8 Gs max.
*/
kRange_8G = 2,
/**
* 16 Gs max.
*/
kRange_16G = 3
};
/**
* Common interface for setting the measuring range of an accelerometer.

View File

@@ -14,7 +14,7 @@ class ADXL345_I2C;
namespace sim {
/**
* Class to control a simulated ADXRS450 gyroscope.
* Class to control a simulated ADXL345.
*/
class ADXL345Sim {
public:

View File

@@ -13,7 +13,7 @@ class ADXL362;
namespace sim {
/**
* Class to control a simulated ADXRS450 gyroscope.
* Class to control a simulated ADXL362.
*/
class ADXL362Sim {
public:

View File

@@ -23,9 +23,9 @@ namespace frc::sim {
* voltage). Call the Update() method to update the simulation. Set simulated
* sensor readings with the simulated positions in the GetOutput() method.
*
* @tparam States The number of states of the system.
* @tparam Inputs The number of inputs to the system.
* @tparam Outputs The number of outputs of the system.
* @tparam States Number of states of the system.
* @tparam Inputs Number of inputs to the system.
* @tparam Outputs Number of outputs of the system.
*/
template <int States, int Inputs, int Outputs>
class LinearSystemSim {