Merge "Update docs for C++ (fixes artf3761 and artf3953)"

This commit is contained in:
Brad Miller (WPI)
2014-12-29 13:26:13 -08:00
committed by Gerrit Code Review
39 changed files with 342 additions and 164 deletions

View File

@@ -13,16 +13,16 @@
* Class implements the PWM generation in the FPGA.
*
* The values supplied as arguments for PWM outputs range from -1.0 to 1.0. They are mapped
* to the hardware dependent values, in this case 0-255 for the FPGA.
* to the hardware dependent values, in this case 0-2000 for the FPGA.
* Changes are immediately sent to the FPGA, and the update occurs at the next
* FPGA cycle. There is no delay.
*
* As of revision 0.1.10 of the FPGA, the FPGA interprets the 0-255 values as follows:
* - 255 = full "forward"
* - 254 to 129 = linear scaling from "full forward" to "center"
* - 128 = center value
* - 127 to 2 = linear scaling from "center" to "full reverse"
* - 1 = full "reverse"
* - 2000 = maximum pulse width
* - 1999 to 1001 = linear scaling from "full forward" to "center"
* - 1000 = center value
* - 999 to 2 = linear scaling from "center" to "full reverse"
* - 1 = minimum pulse width (currently .5ms)
* - 0 = disabled (i.e. PWM output is held low)
*/
class PWM : public SensorBase, public ITableListener, public LiveWindowSendable

View File

@@ -17,6 +17,7 @@ constexpr double ADXL345_I2C::kGsPerLSB;
/**
* Constructor.
*
* @param port The I2C port the accelerometer is attached to
* @param range The range (+ or -) that the accelerometer will measure.
*/
ADXL345_I2C::ADXL345_I2C(Port port, Range range):
@@ -84,7 +85,7 @@ double ADXL345_I2C::GetAcceleration(ADXL345_I2C::Axes axis)
/**
* Get the acceleration of all axes in Gs.
*
* @return Acceleration measured on all axes of the ADXL345 in Gs.
* @return An object containing the acceleration measured on each axis of the ADXL345 in Gs.
*/
ADXL345_I2C::AllAxes ADXL345_I2C::GetAccelerations()
{

View File

@@ -14,6 +14,13 @@ const uint8_t ADXL345_SPI::kDataFormatRegister;
const uint8_t ADXL345_SPI::kDataRegister;
constexpr double ADXL345_SPI::kGsPerLSB;
/**
* Constructor.
*
* @param port The SPI port the accelerometer is attached to
* @param range The range (+ or -) that the accelerometer will measure.
*/
ADXL345_SPI::ADXL345_SPI(SPI::Port port, ADXL345_SPI::Range range)
{
m_port = port;
@@ -106,7 +113,7 @@ double ADXL345_SPI::GetAcceleration(ADXL345_SPI::Axes axis)
/**
* Get the acceleration of all axes in Gs.
*
* @return Acceleration measured on all axes of the ADXL345 in Gs.
* @return An object containing the acceleration measured on each axis of the ADXL345 in Gs.
*/
ADXL345_SPI::AllAxes ADXL345_SPI::GetAccelerations()
{

View File

@@ -23,8 +23,8 @@ void AnalogAccelerometer::InitAccelerometer()
/**
* Create a new instance of an accelerometer.
*
* The constructor allocates desired analog input.
* @param channel The channel number for the analog input the accelerometer is connected to
*/
AnalogAccelerometer::AnalogAccelerometer(int32_t channel)
{
@@ -38,6 +38,7 @@ AnalogAccelerometer::AnalogAccelerometer(int32_t channel)
* Make a new instance of accelerometer given an AnalogInput. This is particularly
* useful if the port is going to be read as an analog channel as well as through
* the Accelerometer class.
* @param channel The existing AnalogInput object for the analog input the accelerometer is connected to
*/
AnalogAccelerometer::AnalogAccelerometer(AnalogInput *channel)
{
@@ -80,7 +81,7 @@ float AnalogAccelerometer::GetAcceleration()
* Set the accelerometer sensitivity.
*
* This sets the sensitivity of the accelerometer used for calculating the acceleration.
* The sensitivity varys by accelerometer model. There are constants defined for various models.
* The sensitivity varies by accelerometer model. There are constants defined for various models.
*
* @param sensitivity The sensitivity of accelerometer in Volts per G.
*/
@@ -92,7 +93,7 @@ void AnalogAccelerometer::SetSensitivity(float sensitivity)
/**
* Set the voltage that corresponds to 0 G.
*
* The zero G voltage varys by accelerometer model. There are constants defined for various models.
* The zero G voltage varies by accelerometer model. There are constants defined for various models.
*
* @param zero The zero G voltage.
*/

View File

@@ -54,7 +54,7 @@ void AnalogInput::InitAnalogInput(uint32_t channel)
/**
* Construct an analog input.
*
* @param channel The channel number to represent.
* @param channel The channel number on the roboRIO to represent. 0-3 are on-board 4-7 are on the MXP port.
*/
AnalogInput::AnalogInput(uint32_t channel)
{
@@ -86,9 +86,9 @@ int16_t AnalogInput::GetValue()
/**
* Get a sample from the output of the oversample and average engine for this channel.
* The sample is 12-bit + the value configured in SetOversampleBits().
* The sample is 12-bit + the bits configured in SetOversampleBits().
* The value configured in SetAverageBits() will cause this value to be averaged 2**bits number of samples.
* This is not a sliding window. The sample will not change until 2**(OversamplBits + AverageBits) samples
* This is not a sliding window. The sample will not change until 2**(OversampleBits + AverageBits) samples
* have been acquired from the module on this channel.
* Use GetAverageVoltage() to get the analog value in calibrated units.
* @return A sample from the oversample and average engine for this channel.
@@ -176,7 +176,7 @@ uint32_t AnalogInput::GetChannel()
/**
* Set the number of averaging bits.
* This sets the number of averaging bits. The actual number of averaged samples is 2**bits.
* This sets the number of averaging bits. The actual number of averaged samples is 2^bits.
* Use averaging to improve the stability of your measurement at the expense of sampling rate.
* The averaging is done automatically in the FPGA.
*
@@ -192,7 +192,7 @@ void AnalogInput::SetAverageBits(uint32_t bits)
/**
* Get the number of averaging bits previously configured.
* This gets the number of averaging bits from the FPGA. The actual number of averaged samples is 2**bits.
* This gets the number of averaging bits from the FPGA. The actual number of averaged samples is 2^bits.
* The averaging is done automatically in the FPGA.
*
* @return Number of bits of averaging previously configured.
@@ -207,7 +207,7 @@ uint32_t AnalogInput::GetAverageBits()
/**
* Set the number of oversample bits.
* This sets the number of oversample bits. The actual number of oversampled values is 2**bits.
* This sets the number of oversample bits. The actual number of oversampled values is 2^bits.
* Use oversampling to improve the resolution of your measurements at the expense of sampling rate.
* The oversampling is done automatically in the FPGA.
*
@@ -224,7 +224,7 @@ void AnalogInput::SetOversampleBits(uint32_t bits)
/**
* Get the number of oversample bits previously configured.
* This gets the number of oversample bits from the FPGA. The actual number of oversampled values is
* 2**bits. The oversampling is done automatically in the FPGA.
* 2^bits. The oversampling is done automatically in the FPGA.
*
* @return Number of bits of oversampling previously configured.
*/
@@ -265,7 +265,7 @@ void AnalogInput::InitAccumulator()
/**
* Set an inital value for the accumulator.
* Set an initial value for the accumulator.
*
* This will be added to all values returned to the user.
* @param initialValue The value that the accumulator should start from when reset.
@@ -301,11 +301,11 @@ void AnalogInput::ResetAccumulator()
* Set the center value of the accumulator.
*
* The center value is subtracted from each A/D value before it is added to the accumulator. This
* is used for the center value of devices like gyros and accelerometers to make integration work
* and to take the device offset into account when integrating.
* is used for the center value of devices like gyros and accelerometers to
* take the device offset into account when integrating.
*
* This center value is based on the output of the oversampled and averaged source from channel 1.
* Because of this, any non-zero oversample bits will affect the size of the value for this field.
* This center value is based on the output of the oversampled and averaged source from the accumulator
* channel. Because of this, any non-zero oversample bits will affect the size of the value for this field.
*/
void AnalogInput::SetAccumulatorCenter(int32_t center)
{
@@ -317,6 +317,7 @@ void AnalogInput::SetAccumulatorCenter(int32_t center)
/**
* Set the accumulator's deadband.
* @param
*/
void AnalogInput::SetAccumulatorDeadband(int32_t deadband)
{
@@ -329,7 +330,7 @@ void AnalogInput::SetAccumulatorDeadband(int32_t deadband)
/**
* Read the accumulated value.
*
* Read the value that has been accumulating on channel 1.
* Read the value that has been accumulating.
* The accumulator is attached after the oversample and average engine.
*
* @return The 64-bit value accumulated since the last Reset().
@@ -379,8 +380,9 @@ void AnalogInput::GetAccumulatorOutput(int64_t *value, uint32_t *count)
}
/**
* Set the sample rate for all analog channels.
*
* Set the sample rate per channel for all analog channels.
* The maximum rate is 500kS/s divided by the number of channels in use.
* This is 62500 samples/s per channel.
* @param samplesPerSecond The number of samples per second.
*/
void AnalogInput::SetSampleRate(float samplesPerSecond)

View File

@@ -44,12 +44,17 @@ void AnalogOutput::InitAnalogOutput(uint32_t channel) {
}
/**
* Construct an anlog output on the given channel
* Construct an analog output on the given channel.
* All analog outputs are located on the MXP port.
* @param The channel number on the roboRIO to represent.
*/
AnalogOutput::AnalogOutput(uint32_t channel) {
InitAnalogOutput(channel);
}
/**
* Destructor. Frees analog output resource
*/
AnalogOutput::~AnalogOutput() {
outputs->Free(m_channel);
}

View File

@@ -11,21 +11,42 @@ void AnalogPotentiometer::initPot(AnalogInput *input, double fullRange, double o
m_analog_input = input;
}
/**
* Construct an Analog Potentiometer object from a channel number.
* @param channel The channel number on the roboRIO to represent. 0-3 are on-board 4-7 are on the MXP port.
* @param fullRange The angular value (in desired units) representing the full 0-5V range of the input.
* @param offset The angular value (in desired units) representing the angular output at 0V.
*/
AnalogPotentiometer::AnalogPotentiometer(int channel, double fullRange, double offset) {
m_init_analog_input = true;
initPot(new AnalogInput(channel), fullRange, offset);
}
/**
* Construct an Analog Potentiometer object from an existing Analog Input pointer.
* @param channel The existing Analog Input pointer
* @param fullRange The angular value (in desired units) representing the full 0-5V range of the input.
* @param offset The angular value (in desired units) representing the angular output at 0V.
*/
AnalogPotentiometer::AnalogPotentiometer(AnalogInput *input, double fullRange, double offset) {
m_init_analog_input = false;
initPot(input, fullRange, offset);
}
/**
* Construct an Analog Potentiometer object from an existing Analog Input reference.
* @param channel The existing Analog Input reference
* @param fullRange The angular value (in desired units) representing the full 0-5V range of the input.
* @param offset The angular value (in desired units) representing the angular output at 0V.
*/
AnalogPotentiometer::AnalogPotentiometer(AnalogInput &input, double fullRange, double offset) {
m_init_analog_input = false;
initPot(&input, fullRange, offset);
}
/**
* Destructor. Releases the Analog Input resource if it was allocated by this object
*/
AnalogPotentiometer::~AnalogPotentiometer() {
if(m_init_analog_input){
delete m_analog_input;
@@ -36,7 +57,7 @@ AnalogPotentiometer::~AnalogPotentiometer() {
/**
* Get the current reading of the potentiometer.
*
* @return The current position of the potentiometer.
* @return The current position of the potentiometer (in the units used for fullRaneg and offset).
*/
double AnalogPotentiometer::Get() {
return (m_analog_input->GetVoltage() / ControllerPower::GetVoltage5V()) * m_fullRange + m_offset;

View File

@@ -29,7 +29,7 @@ void AnalogTrigger::InitTrigger(uint32_t channel)
/**
* Constructor for an analog trigger given a channel number.
*
* @param channel The analog channel (0..7).
* @param channel The channel number on the roboRIO to represent. 0-3 are on-board 4-7 are on the MXP port.
*/
AnalogTrigger::AnalogTrigger(int32_t channel)
{
@@ -40,6 +40,7 @@ AnalogTrigger::AnalogTrigger(int32_t channel)
* Construct an analog trigger given an analog input.
* This should be used in the case of sharing an analog channel between the
* trigger and an analog input object.
* @param channel The pointer to the existing AnalogInput object
*/
AnalogTrigger::AnalogTrigger(AnalogInput *input)
{
@@ -57,6 +58,8 @@ AnalogTrigger::~AnalogTrigger()
* Set the upper and lower limits of the analog trigger.
* The limits are given in ADC codes. If oversampling is used, the units must be scaled
* appropriately.
* @param lower The lower limit of the trigger in ADC codes (12-bit values).
* @param upper The upper limit of the trigger in ADC codes (12-bit values).
*/
void AnalogTrigger::SetLimitsRaw(int32_t lower, int32_t upper)
{
@@ -69,6 +72,8 @@ void AnalogTrigger::SetLimitsRaw(int32_t lower, int32_t upper)
/**
* Set the upper and lower limits of the analog trigger.
* The limits are given as floating point voltage values.
* @param lower The lower limit of the trigger in Volts.
* @param upper The upper limit of the trigger in Volts.
*/
void AnalogTrigger::SetLimitsVoltage(float lower, float upper)
{
@@ -82,6 +87,7 @@ void AnalogTrigger::SetLimitsVoltage(float lower, float upper)
* Configure the analog trigger to use the averaged vs. raw values.
* If the value is true, then the averaged value is selected for the analog trigger, otherwise
* the immediate value is used.
* @param useAveragedValue If true, use the Averaged value, otherwise use the instantaneous reading
*/
void AnalogTrigger::SetAveraged(bool useAveragedValue)
{
@@ -95,6 +101,7 @@ void AnalogTrigger::SetAveraged(bool useAveragedValue)
* Configure the analog trigger to use a filtered value.
* The analog trigger will operate with a 3 point average rejection filter. This is designed to
* help with 360 degree pot applications for the period where the pot crosses through zero.
* @param useFilteredValue If true, use the 3 point rejection filter, otherwise use the unfiltered value
*/
void AnalogTrigger::SetFiltered(bool useFilteredValue)
{
@@ -118,7 +125,7 @@ uint32_t AnalogTrigger::GetIndex()
/**
* Return the InWindow output of the analog trigger.
* True if the analog input is between the upper and lower limits.
* @return The InWindow output of the analog trigger.
* @return True if the analog input is between the upper and lower limits.
*/
bool AnalogTrigger::GetInWindow()
{
@@ -134,7 +141,7 @@ bool AnalogTrigger::GetInWindow()
* True if above upper limit.
* False if below lower limit.
* If in Hysteresis, maintain previous state.
* @return The TriggerState output of the analog trigger.
* @return True if above upper limit. False if below lower limit. If in Hysteresis, maintain previous state.
*/
bool AnalogTrigger::GetTriggerState()
{

View File

@@ -15,7 +15,7 @@ void Compressor::InitCompressor(uint8_t pcmID) {
/**
* Constructor
*
* Uses the default solenoid module number
* Uses the default PCM ID (0)
*/
Compressor::Compressor() {
InitCompressor(GetDefaultSolenoidModule());
@@ -24,7 +24,7 @@ Compressor::Compressor() {
/**
* Constructor
*
* @param module The module number to use (1 or 2)
* @param module The PCM ID to use (0-62)
*/
Compressor::Compressor(uint8_t pcmID) {
InitCompressor(pcmID);
@@ -35,20 +35,21 @@ Compressor::~Compressor() {
}
/**
* Starts closed-loop control
* Starts closed-loop control. Note that closed loop control is enabled by default.
*/
void Compressor::Start() {
SetClosedLoopControl(true);
}
/**
* Stops closed-loop control
* Stops closed-loop control. Note that closed loop control is enabled by default.
*/
void Compressor::Stop() {
SetClosedLoopControl(false);
}
/**
* Check if compressor output is active
* @return true if the compressor is on
*/
bool Compressor::Enabled() {
@@ -65,6 +66,7 @@ bool Compressor::Enabled() {
}
/**
* Check if the pressure switch is triggered
* @return true if pressure is low
*/
bool Compressor::GetPressureSwitchValue() {
@@ -82,6 +84,7 @@ bool Compressor::GetPressureSwitchValue() {
/**
* Query how much current the compressor is drawing
* @return The current through the compressor, in amps
*/
float Compressor::GetCompressorCurrent() {
@@ -101,6 +104,7 @@ float Compressor::GetCompressorCurrent() {
/**
* Enables or disables automatically turning the compressor on when the
* pressure is low.
* @param on Set to true to enable closed loop control of the compressor. False to disable.
*/
void Compressor::SetClosedLoopControl(bool on) {
int32_t status = 0;
@@ -115,6 +119,7 @@ void Compressor::SetClosedLoopControl(bool on) {
/**
* Returns true if the compressor will automatically turn on when the
* pressure is low.
* @return True if closed loop control of the compressor is enabled. False if disabled.
*/
bool Compressor::GetClosedLoopControl() {
int32_t status = 0;
@@ -130,6 +135,7 @@ bool Compressor::GetClosedLoopControl() {
}
/**
* Query if the compressor output has been disabled due to high current draw.
* @return true if PCM is in fault state : Compressor Drive is
* disabled due to compressor current being too high.
*/
@@ -146,6 +152,8 @@ bool Compressor::GetCompressorCurrentTooHighFault() {
return value;
}
/**
* Query if the compressor output has been disabled due to high current draw (sticky).
* A sticky fault will not clear on device reboot, it must be cleared through code or the webdash.
* @return true if PCM sticky fault is set : Compressor Drive is
* disabled due to compressor current being too high.
*/
@@ -162,6 +170,8 @@ bool Compressor::GetCompressorCurrentTooHighStickyFault() {
return value;
}
/**
* Query if the compressor output has been disabled due to a short circuit (sticky).
* A sticky fault will not clear on device reboot, it must be cleared through code or the webdash.
* @return true if PCM sticky fault is set : Compressor output
* appears to be shorted.
*/
@@ -178,6 +188,7 @@ bool Compressor::GetCompressorShortedStickyFault() {
return value;
}
/**
* Query if the compressor output has been disabled due to a short circuit.
* @return true if PCM is in fault state : Compressor output
* appears to be shorted.
*/
@@ -194,6 +205,8 @@ bool Compressor::GetCompressorShortedFault() {
return value;
}
/**
* Query if the compressor output does not appear to be wired (sticky).
* A sticky fault will not clear on device reboot, it must be cleared through code or the webdash.
* @return true if PCM sticky fault is set : Compressor does not
* appear to be wired, i.e. compressor is
* not drawing enough current.
@@ -211,6 +224,7 @@ bool Compressor::GetCompressorNotConnectedStickyFault() {
return value;
}
/**
* Query if the compressor output does not appear to be wired.
* @return true if PCM is in fault state : Compressor does not
* appear to be wired, i.e. compressor is
* not drawing enough current.

View File

@@ -13,7 +13,7 @@
/**
* Get the input voltage to the robot controller
* @return The controller input voltage value
* @return The controller input voltage value in Volts
*/
double ControllerPower::GetInputVoltage() {
int32_t status = 0;
@@ -24,7 +24,7 @@ double ControllerPower::GetInputVoltage() {
/**
* Get the input current to the robot controller
* @return The controller input current value
* @return The controller input current value in Amps
*/
double ControllerPower::GetInputCurrent() {
int32_t status = 0;
@@ -35,7 +35,7 @@ double ControllerPower::GetInputCurrent() {
/**
* Get the voltage of the 6V rail
* @return The controller 6V rail voltage value
* @return The controller 6V rail voltage value in Volts
*/
double ControllerPower::GetVoltage6V() {
int32_t status = 0;
@@ -46,7 +46,7 @@ double ControllerPower::GetVoltage6V() {
/**
* Get the current output of the 6V rail
* @return The controller 6V rail output current value
* @return The controller 6V rail output current value in Amps
*/
double ControllerPower::GetCurrent6V() {
int32_t status = 0;
@@ -58,7 +58,7 @@ double ControllerPower::GetCurrent6V() {
/**
* Get the enabled state of the 6V rail. The rail may be disabled due to a controller
* brownout, a short circuit on the rail, or controller over-voltage
* @return The controller 6V rail enabled value
* @return The controller 6V rail enabled value. True for enabled.
*/
bool ControllerPower::GetEnabled6V() {
int32_t status = 0;
@@ -69,7 +69,7 @@ bool ControllerPower::GetEnabled6V() {
/**
* Get the count of the total current faults on the 6V rail since the controller has booted
* @return The number of faults
* @return The number of faults.
*/
int ControllerPower::GetFaultCount6V() {
int32_t status = 0;
@@ -80,6 +80,7 @@ int ControllerPower::GetFaultCount6V() {
/**
* Get the voltage of the 5V rail
* @return The controller 5V rail voltage value in Volts
*/
double ControllerPower::GetVoltage5V() {
int32_t status = 0;
@@ -90,6 +91,7 @@ double ControllerPower::GetVoltage5V() {
/**
* Get the current output of the 5V rail
* @return The controller 5V rail output current value in Amps
*/
double ControllerPower::GetCurrent5V() {
int32_t status = 0;
@@ -101,7 +103,7 @@ double ControllerPower::GetCurrent5V() {
/**
* Get the enabled state of the 5V rail. The rail may be disabled due to a controller
* brownout, a short circuit on the rail, or controller over-voltage
* @return The controller 5V rail enabled value
* @return The controller 5V rail enabled value. True for enabled.
*/
bool ControllerPower::GetEnabled5V() {
int32_t status = 0;
@@ -123,6 +125,7 @@ int ControllerPower::GetFaultCount5V() {
/**
* Get the voltage of the 3.3V rail
* @return The controller 3.3V rail voltage value in Volts
*/
double ControllerPower::GetVoltage3V3() {
int32_t status = 0;
@@ -133,6 +136,7 @@ double ControllerPower::GetVoltage3V3() {
/**
* Get the current output of the 3.3V rail
* @return The controller 3.3V rail output current value in Amps
*/
double ControllerPower::GetCurrent3V3() {
int32_t status = 0;
@@ -145,7 +149,7 @@ double ControllerPower::GetCurrent3V3() {
/**
* Get the enabled state of the 3.3V rail. The rail may be disabled due to a controller
* brownout, a short circuit on the rail, or controller over-voltage
* @return The controller 3.3V rail enabled value
* @return The controller 3.3V rail enabled value. True for enabled.
*/
bool ControllerPower::GetEnabled3V3() {
int32_t status = 0;

View File

@@ -16,6 +16,7 @@
* This creates a ChipObject counter and initializes status variables appropriately
*
* The counter will start counting immediately.
* @param mode The counter mode
*/
void Counter::InitCounter(Mode mode)
{
@@ -38,7 +39,7 @@ void Counter::InitCounter(Mode mode)
/**
* Create an instance of a counter where no sources are selected.
* Then they all must be selected by calling functions to specify the upsource and the downsource
* They all must be selected by calling functions to specify the upsource and the downsource
* independently.
*
* The counter will start counting immediately.
@@ -52,11 +53,12 @@ Counter::Counter() :
}
/**
* Create an instance of a counter from a Digital Input.
* Create an instance of a counter from a Digital Source (such as a Digital Input).
* This is used if an existing digital input is to be shared by multiple other objects such
* as encoders.
* as encoders or if the Digital Source is not a Digital Input channel (such as an Analog Trigger).
*
* The counter will start counting immediately.
* @param source A pointer to the existing DigitalSource object. It will be set as the Up Source.
*/
Counter::Counter(DigitalSource *source) :
m_upSource(NULL),
@@ -68,6 +70,14 @@ Counter::Counter(DigitalSource *source) :
ClearDownSource();
}
/**
* Create an instance of a counter from a Digital Source (such as a Digital Input).
* This is used if an existing digital input is to be shared by multiple other objects such
* as encoders or if the Digital Source is not a Digital Input channel (such as an Analog Trigger).
*
* The counter will start counting immediately.
* @param source A reference to the existing DigitalSource object. It will be set as the Up Source.
*/
Counter::Counter(DigitalSource &source) :
m_upSource(NULL),
m_downSource(NULL),
@@ -83,6 +93,7 @@ Counter::Counter(DigitalSource &source) :
* Create an up-Counter instance given a channel.
*
* The counter will start counting immediately.
* @param channel The DIO channel to use as the up source. 0-9 are on-board, 10-25 are on the MXP
*/
Counter::Counter(int32_t channel) :
m_upSource(NULL),
@@ -100,6 +111,7 @@ Counter::Counter(int32_t channel) :
* Use the trigger state output from the analog trigger.
*
* The counter will start counting immediately.
* @param trigger The pointer to the existing AnalogTrigger object.
*/
Counter::Counter(AnalogTrigger *trigger) :
m_upSource(NULL),
@@ -112,6 +124,14 @@ Counter::Counter(AnalogTrigger *trigger) :
m_allocatedUpSource = true;
}
/**
* Create an instance of a Counter object.
* Create an instance of a simple up-Counter given an analog trigger.
* Use the trigger state output from the analog trigger.
*
* The counter will start counting immediately.
* @param trigger The reference to the existing AnalogTrigger object.
*/
Counter::Counter(AnalogTrigger &trigger) :
m_upSource(NULL),
m_downSource(NULL),
@@ -123,6 +143,15 @@ Counter::Counter(AnalogTrigger &trigger) :
m_allocatedUpSource = true;
}
/**
* Create an instance of a Counter object.
* Creates a full up-down counter given two Digital Sources
* @param encodingType The quadrature decoding mode (1x or 2x)
* @param upSource The pointer to the DigitalSource to set as the up source
* @param downSource The pointer to the DigitalSource to set as the down source
* @param inverted True to invert the output (reverse the direction)
*/
Counter::Counter(EncodingType encodingType, DigitalSource *upSource, DigitalSource *downSource, bool inverted) :
m_upSource(NULL),
m_downSource(NULL),
@@ -178,6 +207,7 @@ Counter::~Counter()
/**
* Set the upsource for the counter as a digital input channel.
* @param channel The DIO channel to use as the up source. 0-9 are on-board, 10-25 are on the MXP
*/
void Counter::SetUpSource(int32_t channel)
{
@@ -211,6 +241,7 @@ void Counter::SetUpSource(AnalogTrigger &analogTrigger, AnalogTriggerType trigge
/**
* Set the source object that causes the counter to count up.
* Set the up counting DigitalSource.
* @param source Pointer to the DigitalSource object to set as the up source
*/
void Counter::SetUpSource(DigitalSource *source)
{
@@ -238,6 +269,7 @@ void Counter::SetUpSource(DigitalSource *source)
/**
* Set the source object that causes the counter to count up.
* Set the up counting DigitalSource.
* @param source Reference to the DigitalSource object to set as the up source
*/
void Counter::SetUpSource(DigitalSource &source)
{
@@ -246,7 +278,9 @@ void Counter::SetUpSource(DigitalSource &source)
/**
* Set the edge sensitivity on an up counting source.
* Set the up source to either detect rising edges or falling edges.
* Set the up source to either detect rising edges or falling edges or both.
* @param risingEdge True to trigger on rising edges
* @param fallingEdge True to trigger on falling edges
*/
void Counter::SetUpSourceEdge(bool risingEdge, bool fallingEdge)
{
@@ -279,6 +313,7 @@ void Counter::ClearUpSource()
/**
* Set the down counting source to be a digital input channel.
* @param channel The DIO channel to use as the up source. 0-9 are on-board, 10-25 are on the MXP
*/
void Counter::SetDownSource(int32_t channel)
{
@@ -312,6 +347,7 @@ void Counter::SetDownSource(AnalogTrigger &analogTrigger, AnalogTriggerType trig
/**
* Set the source object that causes the counter to count down.
* Set the down counting DigitalSource.
* @param source Pointer to the DigitalSource object to set as the down source
*/
void Counter::SetDownSource(DigitalSource *source)
{
@@ -339,6 +375,7 @@ void Counter::SetDownSource(DigitalSource *source)
/**
* Set the source object that causes the counter to count down.
* Set the down counting DigitalSource.
* @param source Reference to the DigitalSource object to set as the down source
*/
void Counter::SetDownSource(DigitalSource &source)
{
@@ -348,6 +385,8 @@ void Counter::SetDownSource(DigitalSource &source)
/**
* Set the edge sensitivity on a down counting source.
* Set the down source to either detect rising edges or falling edges.
* @param risingEdge True to trigger on rising edges
* @param fallingEdge True to trigger on falling edges
*/
void Counter::SetDownSourceEdge(bool risingEdge, bool fallingEdge)
{
@@ -486,11 +525,11 @@ void Counter::Reset()
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
/*
/**
* Get the Period of the most recent count.
* Returns the time interval of the most recent count. This can be used for velocity calculations
* to determine shaft speed.
* @returns The period of the last two pulses in units of seconds.
* @returns The period between the last two pulses in units of seconds.
*/
double Counter::GetPeriod()
{
@@ -527,6 +566,7 @@ void Counter::SetMaxPeriod(double maxPeriod)
* output (except when there have been no events since an FPGA reset) and you will likely not
* see the stopped bit become true (since it is updated at the end of an average and there are
* no samples to average).
* @param enabled True to enable update when empty
*/
void Counter::SetUpdateWhenEmpty(bool enabled)
{

View File

@@ -40,7 +40,7 @@ void DigitalInput::InitDigitalInput(uint32_t channel)
* Create an instance of a Digital Input class.
* Creates a digital input given a channel.
*
* @param channel The digital channel (0..19).
* @param channel The DIO channel 0-9 are on-board, 10-25 are on the MXP port
*/
DigitalInput::DigitalInput(uint32_t channel)
{
@@ -67,7 +67,7 @@ DigitalInput::~DigitalInput()
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
/*
/**
* Get the value from a digital input channel.
* Retrieve the value of a single digital input channel from the FPGA.
*/

View File

@@ -39,7 +39,7 @@ void DigitalOutput::InitDigitalOutput(uint32_t channel)
* Create an instance of a digital output.
* Create a digital output given a channel.
*
* @param channel The digital channel (0..19)
* @param channel The digital channel 0-9 are on-board, 10-25 are on the MXP port
*/
DigitalOutput::DigitalOutput(uint32_t channel)
{
@@ -63,6 +63,7 @@ DigitalOutput::~DigitalOutput()
/**
* Set the value of a digital output.
* Set the value of a digital output to either one (true) or zero (false).
* @param value 1 (true) for high, 0 (false) for disabled
*/
void DigitalOutput::Set(uint32_t value)
{

View File

@@ -10,7 +10,7 @@
#include "LiveWindow/LiveWindow.h"
/**
* Common function to implement constructor behavior.
* Common function to implement constructor behaviour.
*/
void DoubleSolenoid::InitSolenoid()
{
@@ -59,9 +59,9 @@ void DoubleSolenoid::InitSolenoid()
/**
* Constructor.
*
* @param forwardChannel The forward channel on the module to control.
* @param reverseChannel The reverse channel on the module to control.
* Uses the default PCM ID of 0
* @param forwardChannel The forward channel number on the PCM.
* @param reverseChannel The reverse channel number on the PCM.
*/
DoubleSolenoid::DoubleSolenoid(uint32_t forwardChannel, uint32_t reverseChannel)
: SolenoidBase (GetDefaultSolenoidModule())
@@ -101,7 +101,7 @@ DoubleSolenoid::~DoubleSolenoid()
/**
* Set the value of a solenoid.
*
* @param value Move the solenoid to forward, reverse, or don't move it.
* @param value The value to set (Off, Forward or Reverse)
*/
void DoubleSolenoid::Set(Value value)
{

View File

@@ -116,6 +116,7 @@ void DriverStation::Run()
/**
* Return a pointer to the singleton DriverStation.
* @return Pointer to the DS instance
*/
DriverStation* DriverStation::GetInstance()
{
@@ -146,7 +147,7 @@ void DriverStation::GetData()
/**
* Read the battery voltage.
*
* @return The battery voltage.
* @return The battery voltage in Volts.
*/
float DriverStation::GetBatteryVoltage()
{
@@ -157,6 +158,10 @@ float DriverStation::GetBatteryVoltage()
return voltage;
}
/**
* Reports errors related to unplugged joysticks
* Throttles the errors so that they don't overwhelm the DS
*/
void DriverStation::ReportJoystickUnpluggedError(std::string message) {
double currentTime = Timer::GetFPGATimestamp();
if (currentTime > m_nextMessageTime) {
@@ -165,10 +170,11 @@ void DriverStation::ReportJoystickUnpluggedError(std::string message) {
}
}
/** Returns the number of axis on a given joystick port
/**
* Returns the number of axes on a given joystick port
*
* @param stick The joystick port number
* @return the number of axis on the indicated joystick
* @return The number of axes on the indicated joystick
*/
int DriverStation::GetStickAxisCount(uint32_t stick)
{
@@ -182,10 +188,11 @@ int DriverStation::GetStickAxisCount(uint32_t stick)
return joystickAxes.count;
}
/** Returns the number of POVs on a given joystick port
/**
* Returns the number of POVs on a given joystick port
*
* @param stick The joystick port number
* @return thenumber of POVs on the indicated joystick
* @return The number of POVs on the indicated joystick
*/
int DriverStation::GetStickPOVCount(uint32_t stick)
{
@@ -199,7 +206,8 @@ int DriverStation::GetStickPOVCount(uint32_t stick)
return joystickPOVs.count;
}
/** Returns the number of buttons on a given joystick port
/**
* Returns the number of buttons on a given joystick port
*
* @param stick The joystick port number
* @return The number of buttons on the indicated joystick
@@ -322,6 +330,10 @@ bool DriverStation::GetStickButton(uint32_t stick, uint8_t button)
return ((0x1 << (button-1)) & m_joystickButtons[stick].buttons) !=0;
}
/**
* Check if the DS has enabled the robot
* @return True if the robot is enabled and the DS is connected
*/
bool DriverStation::IsEnabled()
{
HALControlWord controlWord;
@@ -330,6 +342,10 @@ bool DriverStation::IsEnabled()
return controlWord.enabled && controlWord.dsAttached;
}
/**
* Check if the robot is disabled
* @return True if the robot is explicitly disabled or the DS is not connected
*/
bool DriverStation::IsDisabled()
{
HALControlWord controlWord;
@@ -338,6 +354,10 @@ bool DriverStation::IsDisabled()
return !(controlWord.enabled && controlWord.dsAttached);
}
/**
* Check if the DS is commanding autonomous mode
* @return True if the robot is being commanded to be in autonomous mode
*/
bool DriverStation::IsAutonomous()
{
HALControlWord controlWord;
@@ -346,6 +366,10 @@ bool DriverStation::IsAutonomous()
return controlWord.autonomous;
}
/**
* Check if the DS is commanding teleop mode
* @return True if the robot is being commanded to be in teleop mode
*/
bool DriverStation::IsOperatorControl()
{
HALControlWord controlWord;
@@ -354,6 +378,10 @@ bool DriverStation::IsOperatorControl()
return !(controlWord.autonomous || controlWord.test);
}
/**
* Check if the DS is commanding test mode
* @return True if the robot is being commanded to be in test mode
*/
bool DriverStation::IsTest()
{
HALControlWord controlWord;
@@ -361,6 +389,10 @@ bool DriverStation::IsTest()
return controlWord.test;
}
/**
* Check if the DS is attached
* @return True if the DS is connected to the robot
*/
bool DriverStation::IsDSAttached()
{
HALControlWord controlWord;
@@ -369,6 +401,11 @@ bool DriverStation::IsDSAttached()
return controlWord.dsAttached;
}
/**
* Check if the FPGA outputs are enabled. The outputs may be disabled if the robot is disabled
* or e-stopped, the watchdog has expired, or if the roboRIO browns out.
* @return True if the FPGA outputs are enabled.
*/
bool DriverStation::IsSysActive()
{
int32_t status = 0;
@@ -377,6 +414,10 @@ bool DriverStation::IsSysActive()
return retVal;
}
/**
* Check if the system is browned out.
* @return True if the system is browned out
*/
bool DriverStation::IsSysBrownedOut()
{
int32_t status = 0;
@@ -388,7 +429,7 @@ bool DriverStation::IsSysBrownedOut()
/**
* Has a new control packet from the driver station arrived since the last time this function was called?
* Warning: If you call this function from more than one place at the same time,
* you will not get the get the intended behavior
* you will not get the get the intended behaviour.
* @return True if the control data has been updated since the last call.
*/
bool DriverStation::IsNewControlData()
@@ -398,7 +439,6 @@ bool DriverStation::IsNewControlData()
/**
* Is the driver station attached to a Field Management System?
* Note: This does not work with the Blue DS.
* @return True if the robot is competing on a field being controlled by a Field Management System
*/
bool DriverStation::IsFMSAttached()
@@ -411,7 +451,7 @@ bool DriverStation::IsFMSAttached()
/**
* Return the alliance that the driver station says it is on.
* This could return kRed or kBlue
* @return The Alliance enum
* @return The Alliance enum (kRed, kBlue or kInvalid)
*/
DriverStation::Alliance DriverStation::GetAlliance()
{
@@ -435,7 +475,7 @@ DriverStation::Alliance DriverStation::GetAlliance()
/**
* Return the driver station location on the field
* This could return 1, 2, or 3
* @return The location of the driver station
* @return The location of the driver station (1-3, 0 for invalid)
*/
uint32_t DriverStation::GetLocation()
{
@@ -469,13 +509,12 @@ void DriverStation::WaitForData()
/**
* Return the approximate match time
* The FMS does not currently send the official match time to the robots
* This returns the time since the enable signal sent from the Driver Station
* At the beginning of autonomous, the time is reset to 0.0 seconds
* At the beginning of teleop, the time is reset to +15.0 seconds
* If the robot is disabled, this returns 0.0 seconds
* Warning: This is not an official time (so it cannot be used to argue with referees)
* @return Match time in seconds since the beginning of autonomous
* The FMS does not send an official match time to the robots, but does send an approximate match time.
* The value will count down the time remaining in the current period (auto or teleop).
* Warning: This is not an official time (so it cannot be used to dispute ref calls or guarantee that a function
* will trigger before the match ends)
* The Practice Match function of the DS approximates the behaviour seen on the field.
* @return Time remaining in current match period (auto or teleop)
*/
double DriverStation::GetMatchTime()
{

View File

@@ -76,8 +76,8 @@ void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType)
*
* The counter will start counting immediately.
*
* @param aChannel The a channel digital input channel.
* @param bChannel The b channel digital input channel.
* @param aChannel The a channel DIO channel. 0-9 are on-board, 10-25 are on the MXP port
* @param bChannel The b channel DIO channel. 0-9 are on-board, 10-25 are on the MXP port
* @param reverseDirection represents the orientation of the encoder and inverts the output values
* if necessary so forward represents positive values.
* @param encodingType either k1X, k2X, or k4X to indicate 1X, 2X or 4X decoding. If 4X is

View File

@@ -23,8 +23,8 @@ void GearTooth::EnableDirectionSensing(bool directionSensitive)
/**
* Construct a GearTooth sensor given a channel.
*
* @param channel The GPIO channel that the sensor is connected to.
* @param directionSensitive Enable the pulse length decoding in hardware to specify count direction.
* @param channel The DIO channel that the sensor is connected to. 0-9 are on-board, 10-25 are on the MXP.
* @param directionSensitive True to enable the pulse length decoding in hardware to specify count direction.
*/
GearTooth::GearTooth(uint32_t channel, bool directionSensitive)
: Counter(channel)
@@ -35,10 +35,10 @@ GearTooth::GearTooth(uint32_t channel, bool directionSensitive)
/**
* Construct a GearTooth sensor given a digital input.
* This should be used when sharing digial inputs.
* This should be used when sharing digital inputs.
*
* @param source An object that fully descibes the input that the sensor is connected to.
* @param directionSensitive Enable the pulse length decoding in hardware to specify count direction.
* @param source A pointer to the existing DigitalSource object (such as a DigitalInput)
* @param directionSensitive True to enable the pulse length decoding in hardware to specify count direction.
*/
GearTooth::GearTooth(DigitalSource *source, bool directionSensitive)
: Counter(source)
@@ -46,6 +46,13 @@ GearTooth::GearTooth(DigitalSource *source, bool directionSensitive)
EnableDirectionSensing(directionSensitive);
}
/**
* Construct a GearTooth sensor given a digital input.
* This should be used when sharing digital inputs.
*
* @param source A reference to the existing DigitalSource object (such as a DigitalInput)
* @param directionSensitive True to enable the pulse length decoding in hardware to specify count direction.
*/
GearTooth::GearTooth(DigitalSource &source, bool directionSensitive): Counter(source)
{
EnableDirectionSensing(directionSensitive);

View File

@@ -19,8 +19,8 @@ constexpr float Gyro::kDefaultVoltsPerDegreePerSecond;
/**
* Initialize the gyro.
* Calibrate the gyro by running for a number of samples and computing the center value for this
* part. Then use the center value as the Accumulator center value for subsequent measurements.
* Calibrate the gyro by running for a number of samples and computing the center value.
* Then use the center value as the Accumulator center value for subsequent measurements.
* It's important to make sure that the robot is not moving while the centering calculations are
* in progress, this is typically done when the robot is first turned on while it's sitting at
* rest before the competition starts.
@@ -71,9 +71,9 @@ void Gyro::InitGyro()
}
/**
* Gyro constructor with only a channel..
* Gyro constructor using the channel number.
*
* @param channel The analog channel the gyro is connected to.
* @param channel The analog channel the gyro is connected to. 0-3 are on-board, 4-7 are on the MXP.
*/
Gyro::Gyro(int32_t channel)
{
@@ -83,10 +83,10 @@ Gyro::Gyro(int32_t channel)
}
/**
* Gyro constructor with a precreated analog channel object.
* Use this constructor when the analog channel needs to be shared. There
* is no reference counting when an AnalogInput is passed to the gyro.
* @param channel The AnalogInput object that the gyro is connected to.
* Gyro constructor with a precreated AnalogInput object.
* Use this constructor when the analog channel needs to be shared.
* This object will not clean up the AnalogInput object when using this constructor
* @param channel A pointer to the AnalogInput object that the gyro is connected to.
*/
Gyro::Gyro(AnalogInput *channel)
{
@@ -102,6 +102,12 @@ Gyro::Gyro(AnalogInput *channel)
}
}
/**
* Gyro constructor with a precreated AnalogInput object.
* Use this constructor when the analog channel needs to be shared.
* This object will not clean up the AnalogInput object when using this constructor
* @param channel A reference to the AnalogInput object that the gyro is connected to.
*/
Gyro::Gyro(AnalogInput &channel)
{
m_analog = &channel;
@@ -133,8 +139,8 @@ Gyro::~Gyro()
*
* The angle is based on the current accumulator value corrected by the oversampling rate, the
* gyro type and the A/D calibration values.
* The angle is continuous, that is can go beyond 360 degrees. This make algorithms that wouldn't
* want to see a discontinuity in the gyro output as it sweeps past 0 on the second time around.
* 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. This heading is based on integration
* of the returned rate from the gyro.
@@ -169,11 +175,12 @@ double Gyro::GetRate( void )
/**
* Set the gyro type based on the sensitivity.
* Set the gyro sensitivity.
* This takes the number of volts/degree/second sensitivity of the gyro and uses it in subsequent
* calculations to allow the code to work with multiple gyros.
* calculations to allow the code to work with multiple gyros. This value is typically found in
* the gyro datasheet.
*
* @param voltsPerDegreePerSecond The type of gyro specified as the voltage that represents one degree/second.
* @param voltsPerDegreePerSecond The sensitivity in Volts/degree/second
*/
void Gyro::SetSensitivity( float voltsPerDegreePerSecond )
{
@@ -193,6 +200,11 @@ void Gyro::SetDeadband( float volts ) {
m_analog->SetAccumulatorDeadband(deadband);
}
/**
* Sets the type of output to use with the WPILib PID class
* The gyro supports using either rate or angle for PID calculations
*/
void Gyro::SetPIDSourceParameter(PIDSourceParameter pidSource)
{
if(pidSource == 0 || pidSource > 2)
@@ -201,9 +213,10 @@ void Gyro::SetPIDSourceParameter(PIDSourceParameter pidSource)
}
/**
* Get the angle in degrees for the PIDSource base object.
* Get the PIDOutput for the PIDSource base object. Can be set to return
* angle or rate using SetPIDSourceParameter(). Defaults to angle.
*
* @return The angle in degrees.
* @return The PIDOutput (angle or rate, defaults to angle)
*/
double Gyro::PIDGet()
{

View File

@@ -12,7 +12,7 @@
/**
* Constructor.
*
* @param Port The I2C port to which the device is connected.
* @param port The I2C port to which the device is connected.
* @param deviceAddress The address of the device on the I2C bus.
*/
I2C::I2C(Port port, uint8_t deviceAddress) :

View File

@@ -44,10 +44,7 @@ void IterativeRobot::Prestart() {
/**
* Provide an alternate "main loop" via StartCompetition().
*
* This specific StartCompetition() implements "main loop" behavior like that of the FRC
* control system in 2008 and earlier, with a primary (slow) loop that is
* called periodically, and a "fast loop" (a.k.a. "spin loop") that is
* called as fast as possible with no delay between calls.
* This specific StartCompetition() implements "main loop" behaviour synced with the DS packets
*/
void IterativeRobot::StartCompetition()
{

View File

@@ -14,7 +14,7 @@
*/
void Jaguar::InitJaguar()
{
/*
/**
* Input profile defined by Luminary Micro.
*
* Full reverse ranges from 0.671325ms to 0.6972211ms
@@ -33,7 +33,8 @@ void Jaguar::InitJaguar()
}
/**
* @param channel The PWM channel that the Jaguar is attached to.
* Constructor for a Jaguar connected via PWM
* @param channel The PWM channel that the Jaguar is attached to. 0-9 are on-board, 10-19 are on the MXP port
*/
Jaguar::Jaguar(uint32_t channel) : SafePWM(channel)
{

View File

@@ -24,7 +24,7 @@ static bool joySticksInitialized = false;
* Construct an instance of a joystick.
* The joystick index is the usb port on the drivers station.
*
* @param port The port on the driver station that the joystick is plugged into.
* @param port The port on the driver station that the joystick is plugged into (0-5).
*/
Joystick::Joystick(uint32_t port)
: m_ds (NULL)
@@ -221,12 +221,12 @@ bool Joystick::GetBumper(JoystickHand hand)
}
/**
* Get the button value for buttons 1 through 12.
* Get the button value (starting at button 1)
*
* The buttons are returned in a single 16 bit value with one bit representing the state
* of each button. The appropriate button is returned as a boolean value.
*
* @param button The button number to be read.
* @param button The button number to be read (starting at 1)
* @return The state of the button.
**/
bool Joystick::GetRawButton(uint32_t button)
@@ -237,6 +237,7 @@ bool Joystick::GetRawButton(uint32_t button)
/**
* Get the state of a POV on the joystick.
*
* @param pov The index of the POV to read (starting at 0)
* @return the angle of the POV in degrees, or -1 if the POV is not pressed.
*/
int Joystick::GetPOV(uint32_t pov) {

View File

@@ -56,7 +56,7 @@ MotorSafetyHelper::~MotorSafetyHelper()
}
}
/*
/**
* Feed the motor safety object.
* Resets the timer on this object that is used to do the timeouts.
*/
@@ -66,7 +66,7 @@ void MotorSafetyHelper::Feed()
m_stopTime = Timer::GetFPGATimestamp() + m_expiration;
}
/*
/**
* Set the expiration time for the corresponding motor safety object.
* @param expirationTime The timeout value in seconds.
*/
@@ -78,7 +78,7 @@ void MotorSafetyHelper::SetExpiration(float expirationTime)
/**
* Retrieve the timeout value for the corresponding motor safety object.
* @returns the timeout value in seconds.
* @return the timeout value in seconds.
*/
float MotorSafetyHelper::GetExpiration()
{
@@ -88,7 +88,7 @@ float MotorSafetyHelper::GetExpiration()
/**
* Determine if the motor is still operating or has timed out.
* @returns a true value if the motor is still operating normally and hasn't timed out.
* @return a true value if the motor is still operating normally and hasn't timed out.
*/
bool MotorSafetyHelper::IsAlive()
{
@@ -133,7 +133,7 @@ void MotorSafetyHelper::SetSafetyEnabled(bool enabled)
/**
* Return the state of the motor safety enabled flag
* Return if the motor safety is currently enabled for this devicce.
* @returns True if motor safety is enforced for this device
* @return True if motor safety is enforced for this device
*/
bool MotorSafetyHelper::IsSafetyEnabled()
{

View File

@@ -23,6 +23,7 @@ const int32_t PWM::kPwmDisabled;
* This method is private and is the common path for all the constructors for creating PWM
* instances. Checks channel value range and allocates the appropriate channel.
* The allocation is only done to help users ensure that they don't double assign channels.
* @param channel The PWM channel number. 0-9 are on-board, 10-19 are on the MXP port
*/
void PWM::InitPWM(uint32_t channel)
{

View File

@@ -15,6 +15,7 @@ PowerDistributionPanel::PowerDistributionPanel() {
}
/**
* Query the input voltage of the PDP
* @return The voltage of the PDP
*/
double
@@ -31,6 +32,7 @@ PowerDistributionPanel::GetVoltage() {
}
/**
* Query the temperature of the PDP
* @return The temperature of the PDP in degrees Celsius
*/
double
@@ -47,6 +49,7 @@ PowerDistributionPanel::GetTemperature() {
}
/**
* Query the current of a single channel of the PDP
* @return The current of one of the PDP channels (channels 0-15) in Amperes
*/
double
@@ -70,6 +73,7 @@ PowerDistributionPanel::GetCurrent(uint8_t channel) {
}
/**
* Query the total current of all monitored PDP channels (0-15)
* @return The the total current drawn from the PDP channels in Amperes
*/
double
@@ -86,6 +90,7 @@ PowerDistributionPanel::GetTotalCurrent() {
}
/**
* Query the total power drawn from the monitored PDP channels
* @return The the total power drawn from the PDP channels in Joules
*/
double
@@ -102,6 +107,7 @@ PowerDistributionPanel::GetTotalPower() {
}
/**
* Query the total energy drawn from the monitored PDP channels
* @return The the total energy drawn from the PDP channels in Watts
*/
double

View File

@@ -123,6 +123,8 @@ bool RobotBase::IsTest()
/**
* This hook is called right before startCompetition(). By default, tell the DS that the robot is now ready to
* be enabled. If you don't want for the robot to be enabled yet, you can override this method to do nothing.
* If you do so, you will need to call HALNetworkCommunicationObserveUserProgramStarting() from your code when
* you are ready for the robot to be enabled.
*/
void RobotBase::Prestart()
{

View File

@@ -43,12 +43,13 @@ void RobotDrive::InitRobotDrive() {
m_safetyHelper->SetSafetyEnabled(true);
}
/** Constructor for RobotDrive with 2 motors specified with channel numbers.
/**
* Constructor for RobotDrive with 2 motors specified with channel numbers.
* Set up parameters for a two wheel drive system where the
* left and right motor pwm channels are specified in the call.
* This call assumes Talons for controlling the motors.
* @param leftMotorChannel The PWM channel number that drives the left motor.
* @param rightMotorChannel The PWM channel number that drives the right motor.
* @param leftMotorChannel The PWM channel number that drives the left motor. 0-9 are on-board, 10-19 are on the MXP port
* @param rightMotorChannel The PWM channel number that drives the right motor. 0-9 are on-board, 10-19 are on the MXP port
*/
RobotDrive::RobotDrive(uint32_t leftMotorChannel, uint32_t rightMotorChannel)
{
@@ -68,10 +69,10 @@ RobotDrive::RobotDrive(uint32_t leftMotorChannel, uint32_t rightMotorChannel)
* Set up parameters for a four wheel drive system where all four motor
* pwm channels are specified in the call.
* This call assumes Talons for controlling the motors.
* @param frontLeftMotor Front left motor channel number
* @param rearLeftMotor Rear Left motor channel number
* @param frontRightMotor Front right motor channel number
* @param rearRightMotor Rear Right motor channel number
* @param frontLeftMotor Front left motor channel number. 0-9 are on-board, 10-19 are on the MXP port
* @param rearLeftMotor Rear Left motor channel number. 0-9 are on-board, 10-19 are on the MXP port
* @param frontRightMotor Front right motor channel number. 0-9 are on-board, 10-19 are on the MXP port
* @param rearRightMotor Rear Right motor channel number. 0-9 are on-board, 10-19 are on the MXP port
*/
RobotDrive::RobotDrive(uint32_t frontLeftMotor, uint32_t rearLeftMotor,
uint32_t frontRightMotor, uint32_t rearRightMotor)
@@ -94,7 +95,7 @@ RobotDrive::RobotDrive(uint32_t frontLeftMotor, uint32_t rearLeftMotor,
* The SpeedController version of the constructor enables programs to use the RobotDrive classes with
* subclasses of the SpeedController objects, for example, versions with ramping or reshaping of
* the curve to suit motor bias or deadband elimination.
* @param leftMotor The left SpeedController object used to drive the robot.
* @param leftMotor The left SpeedController object used to drive the robot.
* @param rightMotor the right SpeedController object used to drive the robot.
*/
RobotDrive::RobotDrive(SpeedController *leftMotor, SpeedController *rightMotor)

View File

@@ -39,7 +39,9 @@ SPI::~SPI()
/**
* Configure the rate of the generated clock signal.
* The default and maximum value is 500,000 Hz.
*
* The default value is 500,000Hz.
* The maximum value is 4,000,000Hz.
*
* @param hz The clock rate in Hertz.
*/

View File

@@ -19,7 +19,7 @@ void SafePWM::InitSafePWM()
/**
* Constructor for a SafePWM object taking a channel number.
* @param channel The PWM channel number (0..19).
* @param channel The PWM channel number 0-9 are on-board, 10-19 are on the MXP port
*/
SafePWM::SafePWM(uint32_t channel): PWM(channel)
{
@@ -31,7 +31,7 @@ SafePWM::~SafePWM()
delete m_safetyHelper;
}
/*
/**
* Set the expiration time for the PWM object
* @param timeout The timeout (in seconds) for this motor object
*/

View File

@@ -16,6 +16,7 @@
* Create an instance of a Serial Port class.
*
* @param baudRate The baud rate to configure the serial port.
* @param port The physical port to use
* @param dataBits The number of data bits per transfer. Valid values are between 5 and 8 bits.
* @param parity Select the type of parity checking to use.
* @param stopBits The number of stop bits to use as defined by the enum StopBits.
@@ -235,14 +236,4 @@ void SerialPort::Reset()
int32_t status = 0;
serialClear(m_port, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
//void SerialPort::_internalHandler(uint32_t port, uint32_t eventType, uint32_t event)
//{
//}
//ViStatus _VI_FUNCH ioCompleteHandler (ViSession vi, ViEventType eventType, ViEvent event, ViAddr userHandle)
//{
// ((SerialPort*) userHandle)->_internalHandler(vi, eventType, event);
// return VI_SUCCESS;
//}
}

View File

@@ -32,7 +32,7 @@ void Servo::InitServo()
}
/**
* @param channel The PWM channel to which the servo is attached.
* @param channel The PWM channel to which the servo is attached. 0-9 are on-board, 10-19 are on the MXP port
*/
Servo::Servo(uint32_t channel) : SafePWM(channel)
{

View File

@@ -42,9 +42,9 @@ void Solenoid::InitSolenoid()
}
/**
* Constructor.
* Constructor using the default PCM ID (0).
*
* @param channel The channel on the solenoid module to control (1..8).
* @param channel The channel on the PCM to control (0..7).
*/
Solenoid::Solenoid(uint32_t channel)
: SolenoidBase (GetDefaultSolenoidModule())
@@ -56,8 +56,8 @@ Solenoid::Solenoid(uint32_t channel)
/**
* Constructor.
*
* @param moduleNumber The solenoid module (1 or 2).
* @param channel The channel on the solenoid module to control (1..8).
* @param moduleNumber The CAN ID of the PCM the solenoid is attached to
* @param channel The channel on the PCM to control (0..7).
*/
Solenoid::Solenoid(uint8_t moduleNumber, uint32_t channel)
: SolenoidBase (moduleNumber)

View File

@@ -12,7 +12,7 @@ Resource *SolenoidBase::m_allocated = NULL;
/**
* Constructor
*
* @param moduleNumber The solenoid module (1 or 2).
* @param moduleNumber The CAN PCM ID.
*/
SolenoidBase::SolenoidBase(uint8_t moduleNumber)
: m_moduleNumber (moduleNumber)

View File

@@ -17,11 +17,11 @@
* the deadband or inability to saturate the controller in either direction, calibration is recommended.
* The calibration procedure can be found in the Talon User Manual available from CTRE.
*
* - 211 = full "forward"
* - 133 = the "high end" of the deadband range
* - 129 = center of the deadband range (off)
* - 125 = the "low end" of the deadband range
* - 49 = full "reverse"
* 2.037ms = full "forward"
* 1.539ms = the "high end" of the deadband range
* 1.513ms = center of the deadband range (off)
* 1.487ms = the "low end" of the deadband range
* 0.989ms = full "reverse"
*/
void Talon::InitTalon() {
SetBounds(2.037, 1.539, 1.513, 1.487, .989);
@@ -34,7 +34,8 @@ void Talon::InitTalon() {
}
/**
* @param channel The PWM channel that the Talon is attached to.
* Constructor for a Talon (original or Talon SR)
* @param channel The PWM channel number that the Talon is attached to. 0-9 are on-board, 10-19 are on the MXP port
*/
Talon::Talon(uint32_t channel) : SafePWM(channel)
{

View File

@@ -13,10 +13,14 @@
* Common initialization code called by all constructors.
*
* Note that the TalonSRX uses the following bounds for PWM values. These values should work reasonably well for
* most controllers, but if users experience issues such as asymmetric behavior around
* most controllers, but if users experience issues such as asymmetric behaviour around
* the deadband or inability to saturate the controller in either direction, calibration is recommended.
* The calibration procedure can be found in the TalonSRX User Manual available from Cross The Road Electronics.
*
* 2.004ms = full "forward"
* 1.52ms = the "high end" of the deadband range
* 1.50ms = center of the deadband range (off)
* 1.48ms = the "low end" of the deadband range
* 0.997ms = full "reverse"
*/
void TalonSRX::InitTalonSRX() {
SetBounds(2.004, 1.52, 1.50, 1.48, .997);
@@ -29,7 +33,8 @@ void TalonSRX::InitTalonSRX() {
}
/**
* @param channel The PWM channel that the TalonSRX is attached to.
* Construct a TalonSRX connected via PWM
* @param channel The PWM channel that the TalonSRX is attached to. 0-9 are on-board, 10-19 are on the MXP port
*/
TalonSRX::TalonSRX(uint32_t channel) : SafePWM(channel)
{

View File

@@ -28,10 +28,10 @@ void Wait(double seconds)
delaySeconds(seconds);
}
/*
/**
* Return the FPGA system clock time in seconds.
* This is deprecated and just forwards to Timer::GetFPGATimestamp().
* @returns Robot running time in seconds.
* @return Robot running time in seconds.
*/
double GetClock()
{
@@ -80,7 +80,7 @@ Timer::~Timer()
* the current system clock the start time stored in the timer class. If the clock
* is not running, then return the time when it was last stopped.
*
* @return unsigned Current time value for this timer in seconds
* @return Current time value for this timer in seconds
*/
double Timer::Get()
{
@@ -158,7 +158,7 @@ void Timer::Stop()
* work without drifting later by the time it took to get around to checking.
*
* @param period The period to check for (in seconds).
* @return If the period has passed.
* @return True if the period has passed.
*/
bool Timer::HasPeriodPassed(double period)
{
@@ -166,14 +166,14 @@ bool Timer::HasPeriodPassed(double period)
{
Synchronized sync(m_semaphore);
// Advance the start time by the period.
// Don't set it to the current time... we want to avoid drift.
m_startTime += period;
// Don't set it to the current time... we want to avoid drift.
return true;
}
return false;
}
/*
/**
* Return the FPGA system clock time in seconds.
*
* Return the time from the FPGA hardware clock in seconds since the FPGA

View File

@@ -21,7 +21,7 @@
static bool suspendOnAssertEnabled = false;
/**
* Enable suspend on asssert.
* Enable suspend on assert.
* If enabled, the user task will be suspended whenever an assert fails. This
* will allow the user to attach to the task with the debugger and examine variables
* around the failure.
@@ -204,7 +204,7 @@ uint32_t GetFPGATime()
/**
* Get the state of the "USER" button on the RoboRIO
* @return true if the button is currently pressed down
* @return True if the button is currently pressed down
*/
bool GetUserButton()
{
@@ -247,6 +247,7 @@ static std::string demangle(char const *mangledSymbol)
/**
* Get a stack trace, ignoring the first "offset" symbols.
* @param offset The number of symbols at the top of the stack to ignore
*/
std::string GetStackTrace(uint32_t offset)
{

View File

@@ -14,15 +14,15 @@
*
* Note that the Victor uses the following bounds for PWM values. These values were determined
* empirically and optimized for the Victor 888. These values should work reasonably well for
* Victor 884 controllers as well but if users experience issues such as asymmetric behavior around
* Victor 884 controllers as well but if users experience issues such as asymmetric behaviour around
* the deadband or inability to saturate the controller in either direction, calibration is recommended.
* The calibration procedure can be found in the Victor 884 User Manual available from IFI.
*
* - 206 = full "forward"
* - 131 = the "high end" of the deadband range
* - 128 = center of the deadband range (off)
* - 125 = the "low end" of the deadband range
* - 56 = full "reverse"
* 2.027ms = full "forward"
* 1.525ms = the "high end" of the deadband range
* 1.507ms = center of the deadband range (off)
* 1.49ms = the "low end" of the deadband range
* 1.026ms = full "reverse"
*/
void Victor::InitVictor() {
SetBounds(2.027, 1.525, 1.507, 1.49, 1.026);
@@ -36,7 +36,8 @@ void Victor::InitVictor() {
}
/**
* @param channel The PWM channel that the Victor is attached to.
* Constructor for a Victor
* @param channel The PWM channel number that the Victor is attached to. 0-9 are on-board, 10-19 are on the MXP port
*/
Victor::Victor(uint32_t channel) : SafePWM(channel)
{

View File

@@ -17,6 +17,11 @@
* the deadband or inability to saturate the controller in either direction, calibration is recommended.
* The calibration procedure can be found in the VictorSP User Manual available from Vex.
*
* 2.004ms = full "forward"
* 1.52ms = the "high end" of the deadband range
* 1.50ms = center of the deadband range (off)
* 1.48ms = the "low end" of the deadband range
* 0.997ms = full "reverse"
*/
void VictorSP::InitVictorSP() {
SetBounds(2.004, 1.52, 1.50, 1.48, .997);
@@ -29,7 +34,8 @@ void VictorSP::InitVictorSP() {
}
/**
* @param channel The PWM channel that the VictorSP is attached to.
* Constructor for a VictorSP
* @param channel The PWM channel that the VictorSP is attached to. 0-9 are on-board, 10-19 are on the MXP port
*/
VictorSP::VictorSP(uint32_t channel) : SafePWM(channel)
{