[docs] Add romi and xrp to docs build (#7045)

This commit is contained in:
Ryan Blue
2024-09-08 01:21:16 -04:00
committed by GitHub
parent 0cab7b5204
commit 161dfefb4d
17 changed files with 181 additions and 18 deletions

View File

@@ -16,6 +16,8 @@ evaluationDependsOn(':wpimath')
evaluationDependsOn(':wpinet')
evaluationDependsOn(':wpiunits')
evaluationDependsOn(':wpiutil')
evaluationDependsOn(':romiVendordep')
evaluationDependsOn(':xrpVendordep')
def baseArtifactIdCpp = 'documentation'
def artifactGroupIdCpp = 'edu.wpi.first.wpilibc'
@@ -40,6 +42,8 @@ cppProjectZips.add(project(':wpilibc').cppHeadersZip)
cppProjectZips.add(project(':wpimath').cppHeadersZip)
cppProjectZips.add(project(':wpinet').cppHeadersZip)
cppProjectZips.add(project(':wpiutil').cppHeadersZip)
cppProjectZips.add(project(':romiVendordep').cppHeadersZip)
cppProjectZips.add(project(':xrpVendordep').cppHeadersZip)
doxygen {
// Doxygen binaries are only provided for x86_64 platforms
@@ -224,6 +228,8 @@ task generateJavaDocs(type: Javadoc) {
source project(':wpinet').sourceSets.main.java
source project(':wpiunits').sourceSets.main.java
source project(':wpiutil').sourceSets.main.java
source project(':romiVendordep').sourceSets.main.java
source project(':xrpVendordep').sourceSets.main.java
source configurations.javaSource.collect { zipTree(it) }
include '**/*.java'
failOnError = true

View File

@@ -31,8 +31,11 @@ public class OnBoardIO {
private static final double MESSAGE_INTERVAL = 1.0;
private double m_nextMessageTime;
/** Mode for Romi onboard IO channel. */
public enum ChannelMode {
/** Input. */
INPUT,
/** Output. */
OUTPUT
}

View File

@@ -8,6 +8,12 @@ import edu.wpi.first.hal.SimDevice;
import edu.wpi.first.hal.SimDevice.Direction;
import edu.wpi.first.hal.SimDouble;
/**
* Use a rate gyro to return the robots heading relative to a starting position.
*
* <p>This class is for the Romi onboard gyro, and will only work in simulation/Romi mode. Only one
* instance of a RomiGyro is supported.
*/
public class RomiGyro {
private final SimDevice m_simDevice;
private final SimDouble m_simRateX;
@@ -130,10 +136,27 @@ public class RomiGyro {
}
}
/**
* Return the actual angle in degrees that the robot is currently facing.
*
* <p>The angle is based on integration of the returned rate form the gyro. The angle is
* continuous, that is, it will continue from 360->361 degrees. This allows algorithms that
* wouldn't want to see a discontinuity in the gyro output as it sweeps from 360 to 0 on the
* second time around.
*
* @return the current heading of the robot in degrees.
*/
public double getAngle() {
return getAngleZ();
}
/**
* Return the rate of rotation of the gyro
*
* <p>The rate is based on the most recent reading of the gyro.
*
* @return the current rate in degrees per second
*/
public double getRate() {
return getRateZ();
}

View File

@@ -12,6 +12,11 @@
namespace frc {
/**
* @ingroup romi_api
* @{
*/
/**
* This class represents the onboard IO of the Romi
* reference robot. This includes the pushbuttons and
@@ -24,7 +29,8 @@ namespace frc {
*/
class OnBoardIO {
public:
enum ChannelMode { INPUT, OUTPUT };
/** Mode for Romi onboard IO */
enum ChannelMode { /** Input */ INPUT, /** Output */ OUTPUT };
OnBoardIO(OnBoardIO::ChannelMode dio1, OnBoardIO::ChannelMode dio2);
static constexpr auto kMessageInterval = 1_s;
@@ -73,4 +79,6 @@ class OnBoardIO {
std::unique_ptr<frc::DigitalOutput> m_redLed;
};
/** @} */
} // namespace frc

View File

@@ -8,6 +8,11 @@
namespace frc {
/**
* @ingroup romi_api
* @{
*/
/**
* Use a rate gyro to return the robots heading relative to a starting position.
*
@@ -88,4 +93,6 @@ class RomiGyro {
double m_angleZOffset = 0;
};
/** @} */
} // namespace frc

View File

@@ -8,6 +8,11 @@
namespace frc {
/**
* @defgroup romi_api Romi Hardware API
* @{
*/
/**
* RomiMotor
*
@@ -27,4 +32,6 @@ class RomiMotor : public PWMMotorController {
RomiMotor& operator=(RomiMotor&&) = default;
};
/** @} */
} // namespace frc

View File

@@ -27,7 +27,11 @@ public class XRPGyro {
private double m_angleYOffset;
private double m_angleZOffset;
/** Create a new XRPGyro. */
/**
* Constructs an XRPGyro.
*
* <p>Only one instance of a XRPGyro is supported.
*/
public XRPGyro() {
m_simDevice = SimDevice.create("Gyro:XRPGyro");
if (m_simDevice != null) {

View File

@@ -44,7 +44,11 @@ public class XRPMotor implements MotorController {
private final SimDouble m_simSpeed;
private final SimBoolean m_simInverted;
/** XRPMotor. */
/**
* Constructs an XRPMotor.
*
* @param deviceNum the motor channel
*/
public XRPMotor(int deviceNum) {
checkDeviceAllocation(deviceNum);

View File

@@ -11,6 +11,13 @@ import edu.wpi.first.wpilibj.AnalogInput;
public class XRPRangefinder {
private final AnalogInput m_rangefinder = new AnalogInput(2);
/**
* Constructs an XRPRangefinder.
*
* <p>Only one instance of a XRPRangefinder is supported.
*/
public XRPRangefinder() {}
/**
* Get the measured distance in meters. Distance further than 4m will be reported as 4m.
*

View File

@@ -11,6 +11,13 @@ public class XRPReflectanceSensor {
private final AnalogInput m_leftSensor = new AnalogInput(0);
private final AnalogInput m_rightSensor = new AnalogInput(1);
/**
* Constructs an XRPReflectanceSensor.
*
* <p>Only one instance of a XRPReflectanceSensor is supported.
*/
public XRPReflectanceSensor() {}
/**
* Returns the reflectance value of the left sensor.
*

View File

@@ -38,7 +38,11 @@ public class XRPServo {
private final SimDouble m_simPosition;
/** XRPServo. */
/**
* Constructs an XRPServo.
*
* @param deviceNum the servo channel
*/
public XRPServo(int deviceNum) {
checkDeviceAllocation(deviceNum);
@@ -58,18 +62,18 @@ public class XRPServo {
/**
* Set the servo angle.
*
* @param angle Desired angle in degrees
* @param angleDegrees Desired angle in degrees
*/
public void setAngle(double angle) {
if (angle < 0.0) {
angle = 0.0;
public void setAngle(double angleDegrees) {
if (angleDegrees < 0.0) {
angleDegrees = 0.0;
}
if (angle > 180.0) {
angle = 180.0;
if (angleDegrees > 180.0) {
angleDegrees = 180.0;
}
double pos = angle / 180.0;
double pos = angleDegrees / 180.0;
if (m_simPosition != null) {
m_simPosition.set(pos);
@@ -92,19 +96,19 @@ public class XRPServo {
/**
* Set the servo position.
*
* @param pos Desired position (Between 0.0 and 1.0)
* @param position Desired position (Between 0.0 and 1.0)
*/
public void setPosition(double pos) {
if (pos < 0.0) {
pos = 0.0;
public void setPosition(double position) {
if (position < 0.0) {
position = 0.0;
}
if (pos > 1.0) {
pos = 1.0;
if (position > 1.0) {
position = 1.0;
}
if (m_simPosition != null) {
m_simPosition.set(pos);
m_simPosition.set(position);
}
}

View File

@@ -8,6 +8,11 @@
namespace frc {
/**
* @ingroup xrp_api
* @{
*/
/**
* Use a rate gyro to return the robots heading relative to a starting position.
*
@@ -16,6 +21,11 @@ namespace frc {
*/
class XRPGyro {
public:
/**
* Constructs an XRPGyro.
*
* <p>Only one instance of a XRPGyro is supported.
*/
XRPGyro();
/**
@@ -88,4 +98,6 @@ class XRPGyro {
double m_angleZOffset = 0;
};
/** @} */
} // namespace frc

View File

@@ -18,8 +18,18 @@ namespace frc {
WPI_IGNORE_DEPRECATED
/**
* @defgroup xrp_api XRP Hardware API
* @{
*/
class XRPMotor : public frc::MotorController, public frc::MotorSafety {
public:
/**
* Constructs an XRPMotor.
*
* @param deviceNum the motor channel
*/
explicit XRPMotor(int deviceNum);
void Set(double value) override;
@@ -46,6 +56,8 @@ class XRPMotor : public frc::MotorController, public frc::MotorSafety {
static void CheckDeviceAllocation(int deviceNum);
};
/** @} */
WPI_UNIGNORE_DEPRECATED
} // namespace frc

View File

@@ -13,6 +13,11 @@
namespace frc {
/**
* @ingroup xrp_api
* @{
*/
/**
* This class represents the onboard IO of the XRP
* reference robot. This the USER push button and
@@ -43,4 +48,6 @@ class XRPOnBoardIO {
frc::DigitalOutput m_led{1};
};
/** @} */
} // namespace frc

View File

@@ -10,6 +10,11 @@
namespace frc {
/**
* @ingroup xrp_api
* @{
*/
/**
* This class represents the reflectance sensor pair
* on the XRP robot.
@@ -26,4 +31,6 @@ class XRPRangefinder {
frc::AnalogInput m_rangefinder{2};
};
/** @} */
} // namespace frc

View File

@@ -8,6 +8,11 @@
namespace frc {
/**
* @ingroup xrp_api
* @{
*/
/**
* This class represents the reflectance sensor pair
* on the XRP robot.
@@ -31,4 +36,6 @@ class XRPReflectanceSensor {
frc::AnalogInput m_rightSensor{1};
};
/** @} */
} // namespace frc

View File

@@ -12,14 +12,50 @@
namespace frc {
/**
* @ingroup xrp_api
* @{
*/
/**
* XRPServo.
*
* <p>A SimDevice based servo
*/
class XRPServo {
public:
/**
* Constructs an XRPServo.
* @param deviceNum the servo channel
*/
explicit XRPServo(int deviceNum);
/**
* Set the servo angle.
*
* @param angleDegrees Desired angle in degrees
*/
void SetAngle(double angleDegrees);
/**
* Get the servo angle.
*
* @return Current servo angle
*/
double GetAngle() const;
/**
* Set the servo position.
*
* @param position Desired position (Between 0.0 and 1.0)
*/
void SetPosition(double position);
/**
* Get the servo position.
*
* @return Current servo position
*/
double GetPosition() const;
private:
@@ -34,4 +70,6 @@ class XRPServo {
static void CheckDeviceAllocation(int deviceNum);
};
/** @} */
} // namespace frc