[wpilib] Improve and sync AnalogPotentiometer docs (NFC) (#2580)

This commit is contained in:
sciencewhiz
2020-07-13 22:00:53 -07:00
committed by GitHub
parent 16ef372b53
commit b06ddcdd86
2 changed files with 32 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -42,11 +42,12 @@ class AnalogPotentiometer : public ErrorBase,
* This will calculate the result from the fullRange times the fraction of the
* supply voltage, plus the offset.
*
* @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
* @param channel The Analog Input channel number on the roboRIO the
* potentiometer is plugged into. 0-3 are on-board and 4-7
* are on the MXP port.
* @param fullRange The value (in desired units) representing the full
* 0-5V range of the input.
* @param offset The angular value (in desired units) representing the
* @param offset The value (in desired units) representing the
* angular output at 0V.
*/
explicit AnalogPotentiometer(int channel, double fullRange = 1.0,
@@ -66,9 +67,9 @@ class AnalogPotentiometer : public ErrorBase,
* supply voltage, plus the offset.
*
* @param channel The existing Analog Input pointer
* @param fullRange The angular value (in desired units) representing the full
* @param fullRange The value (in desired units) representing the full
* 0-5V range of the input.
* @param offset The angular value (in desired units) representing the
* @param offset The value (in desired units) representing the
* angular output at 0V.
*/
explicit AnalogPotentiometer(AnalogInput* input, double fullRange = 1.0,
@@ -88,9 +89,9 @@ class AnalogPotentiometer : public ErrorBase,
* supply voltage, plus the offset.
*
* @param channel The existing Analog Input pointer
* @param fullRange The angular value (in desired units) representing the full
* @param fullRange The value (in desired units) representing the full
* 0-5V range of the input.
* @param offset The angular value (in desired units) representing the
* @param offset The value (in desired units) representing the
* angular output at 0V.
*/
explicit AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
@@ -102,7 +103,7 @@ class AnalogPotentiometer : public ErrorBase,
AnalogPotentiometer& operator=(AnalogPotentiometer&&) = default;
/**
* Get the current reading of the potentiomer.
* Get the current reading of the potentiometer.
*
* @return The current position of the potentiometer (in the units used for
* fullRange and offset).

View File

@@ -32,7 +32,8 @@ public class AnalogPotentiometer implements Potentiometer, Sendable, AutoCloseab
* point after scaling is 135 degrees. This will calculate the result from the fullRange times
* the fraction of the supply voltage, plus the offset.
*
* @param channel The analog channel this potentiometer is plugged into.
* @param channel The analog input channel this potentiometer is plugged into. 0-3 are
* on-board and 4-7 are on the MXP port.
* @param fullRange The scaling to multiply the fraction by to get a meaningful unit.
* @param offset The offset to add to the scaled value for controlling the zero value
*/
@@ -46,14 +47,16 @@ public class AnalogPotentiometer implements Potentiometer, Sendable, AutoCloseab
* AnalogPotentiometer constructor.
*
* <p>Use the fullRange and offset values so that the output produces meaningful values. I.E: you
* have a 270 degree potentiometer and you want the output to be degrees with the halfway point as
* 0 degrees. The fullRange value is 270.0(degrees) and the offset is -135.0 since the halfway
* have a 270 degree potentiometer and you want the output to be degrees with the halfway point
* as 0 degrees. The fullRange value is 270.0(degrees) and the offset is -135.0 since the halfway
* point after scaling is 135 degrees. This will calculate the result from the fullRange times
* the fraction of the supply voltage, plus the offset.
*
* @param input The {@link AnalogInput} this potentiometer is plugged into.
* @param fullRange The scaling to multiply the fraction by to get a meaningful unit.
* @param offset The offset to add to the scaled value for controlling the zero value
* @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.
*/
public AnalogPotentiometer(final AnalogInput input, double fullRange, double offset) {
SendableRegistry.addLW(this, "AnalogPotentiometer", input.getChannel());
@@ -67,12 +70,12 @@ public class AnalogPotentiometer implements Potentiometer, Sendable, AutoCloseab
/**
* AnalogPotentiometer constructor.
*
* <p>Use the fullRange and offset values so that the output produces meaningful values. I.E: you
* have a 270 degree potentiometer and you want the output to be degrees with the halfway point as
* 0 degrees. The fullRange value is 270.0(degrees) and the offset is -135.0 since the halfway
* point after scaling is 135 degrees.
* <p>Use the scale value so that the output produces meaningful values. I.E: you
* have a 270 degree potentiometer and you want the output to be degrees with the starting point
* as 0 degrees. The scale value is 270.0(degrees).
*
* @param channel The analog channel this potentiometer is plugged into.
* @param channel The analog input channel this potentiometer is plugged into. 0-3 are
* on-board and 4-7 are on the MXP port.
* @param scale The scaling to multiply the voltage by to get a meaningful unit.
*/
public AnalogPotentiometer(final int channel, double scale) {
@@ -83,9 +86,8 @@ public class AnalogPotentiometer implements Potentiometer, Sendable, AutoCloseab
* AnalogPotentiometer constructor.
*
* <p>Use the fullRange and offset values so that the output produces meaningful values. I.E: you
* have a 270 degree potentiometer and you want the output to be degrees with the halfway point as
* 0 degrees. The fullRange value is 270.0(degrees) and the offset is -135.0 since the halfway
* point after scaling is 135 degrees.
* have a 270 degree potentiometer and you want the output to be degrees with the starting point
* as 0 degrees. The scale value is 270.0(degrees).
*
* @param input The {@link AnalogInput} this potentiometer is plugged into.
* @param scale The scaling to multiply the voltage by to get a meaningful unit.
@@ -97,7 +99,10 @@ public class AnalogPotentiometer implements Potentiometer, Sendable, AutoCloseab
/**
* AnalogPotentiometer constructor.
*
* @param channel The analog channel this potentiometer is plugged into.
* <p>The potentiometer will return a value between 0 and 1.0.
*
* @param channel The analog input channel this potentiometer is plugged into. 0-3 are
* on-board and 4-7 are on the MXP port.
*/
public AnalogPotentiometer(final int channel) {
this(channel, 1, 0);
@@ -106,6 +111,8 @@ public class AnalogPotentiometer implements Potentiometer, Sendable, AutoCloseab
/**
* AnalogPotentiometer constructor.
*
* <p>The potentiometer will return a value between 0 and 1.0.
*
* @param input The {@link AnalogInput} this potentiometer is plugged into.
*/
public AnalogPotentiometer(final AnalogInput input) {