本文整理汇总了C++中AnalogChannel::GetAverageVoltage方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalogChannel::GetAverageVoltage方法的具体用法?C++ AnalogChannel::GetAverageVoltage怎么用?C++ AnalogChannel::GetAverageVoltage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalogChannel
的用法示例。
在下文中一共展示了AnalogChannel::GetAverageVoltage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OperatorControl
void OperatorControl(void)
{
NetTest();
return;
myRobot.SetSafetyEnabled(true);
digEncoder.Start();
const double ppsTOrpm = 60.0/250.0; //Convert from Pos per Second to Rotations per Minute by multiplication
// (See the second number on the back of the encoder to replace 250 for different encoders)
const float VoltsToIn = 41.0; // Convert from volts to cm by multiplication (volts from ultrasonic).
// This value worked for distances between 1' and 10'.
while (IsOperatorControl())
{
if (stick.GetRawButton(4)) {
myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), -1);
}
else if (stick.GetRawButton(5))
{
myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), 1);
}
else
{
myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), 0);
}
myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), 0);
SmartDashboard::PutNumber("Digital Encoder RPM", abs(digEncoder.GetRate()*ppsTOrpm));
SmartDashboard::PutNumber("Ultrasonic Distance inch", (double) ultra.GetAverageVoltage()*VoltsPerInch);
SmartDashboard::PutNumber("Ultrasonic Voltage", (double) ultra.GetAverageVoltage());
Wait(0.1);
}
digEncoder.Stop();
}
示例2: GetAnalogAverageVoltage
/**
* Get a scaled sample from the output of the oversample and average engine for this channel.
* The value is scaled to units of Volts using the calibrated scaling data from GetLSBWeight() and GetOffset().
* Using oversampling will cause this value to be higher resolution, but it will update more slowly.
* Using averaging will cause this value to be more stable, but it will update more slowly.
* @param channel The channel in the module assicated with this analog channel
* @return A scaled sample from the output of the oversample and average engine for this channel.
*/
float GetAnalogAverageVoltage(UINT32 channel)
{
AnalogChannel *analog = AllocateAnalogChannel(AnalogModule::GetDefaultAnalogModule(), channel);
if (analog != NULL)
{
return analog->GetAverageVoltage();
}
return 0.0;
}
示例3: CalibrateEnd
void CalibrateEnd()
{
max = pot.GetAverageVoltage();
}
示例4: CalibrateStart
void CalibrateStart()
{
min = pot.GetAverageVoltage();
}
示例5: Get
float Get()
{
return (pot.GetAverageVoltage() - min)/(max - min);
}