mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
Fixed C++ side of artf2604 in FRCSim - synchronized C++ codebases, updated examples.
Change-Id: I2fdc9deb4c8e249448dcbda4214fd900c2bc4ea8
This commit is contained in:
@@ -16,40 +16,27 @@
|
||||
* Victor 884 controllers as well but if users experience issues such as asymmetric behavior 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"
|
||||
*/
|
||||
void Victor::InitVictor(int slot, int channel) {
|
||||
char buffer[50];
|
||||
int n = sprintf(buffer, "pwm/%d/%d", slot, channel);
|
||||
impl = new SimContinuousOutput(buffer);
|
||||
|
||||
void Victor::InitVictor(int channel) {
|
||||
char buffer[50];
|
||||
int n = sprintf(buffer, "pwm/1/%d", channel);
|
||||
impl = new SimContinuousOutput(buffer);
|
||||
|
||||
// TODO: LiveWindow::GetInstance()->AddActuator("Victor", slot, channel, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that assumes the default digital module.
|
||||
*
|
||||
* @param channel The PWM channel on the digital module that the Victor is attached to.
|
||||
* @param channel The PWM channel that the Victor is attached to.
|
||||
*/
|
||||
Victor::Victor(uint32_t channel)
|
||||
{
|
||||
InitVictor(1, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that specifies the digital module.
|
||||
*
|
||||
* @param moduleNumber The digital module (1 or 2).
|
||||
* @param channel The PWM channel on the digital module that the Victor is attached to (1..10).
|
||||
*/
|
||||
Victor::Victor(uint8_t moduleNumber, uint32_t channel)
|
||||
{
|
||||
InitVictor(moduleNumber, channel);
|
||||
InitVictor(channel);
|
||||
}
|
||||
|
||||
Victor::~Victor()
|
||||
@@ -57,8 +44,8 @@ Victor::~Victor()
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the PWM value.
|
||||
*
|
||||
* Set the PWM value.
|
||||
*
|
||||
* The PWM value is set using a range of -1.0 to 1.0, appropriately
|
||||
* scaling the value for the FPGA.
|
||||
*
|
||||
@@ -72,7 +59,7 @@ void Victor::Set(float speed, uint8_t syncGroup)
|
||||
|
||||
/**
|
||||
* Get the recently set value of the PWM.
|
||||
*
|
||||
*
|
||||
* @return The most recently set value for the PWM between -1.0 and 1.0.
|
||||
*/
|
||||
float Victor::Get()
|
||||
@@ -90,11 +77,10 @@ void Victor::Disable()
|
||||
|
||||
/**
|
||||
* Write out the PID value as seen in the PIDOutput base object.
|
||||
*
|
||||
*
|
||||
* @param output Write out the PWM value as was found in the PIDController
|
||||
*/
|
||||
void Victor::PIDWrite(float output)
|
||||
void Victor::PIDWrite(float output)
|
||||
{
|
||||
Set(output);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user