roboRIO掉电处理以及了解电能消耗
为了在高电流消耗期间帮助维持电池电压以保护其自身和其他控制系统组件(例如在高电流事件中保护无线电设备),roboRIO包含分阶段的掉电保护方案。本文介绍了此方案,提供了有关主动计划的系统电流消耗的信息,并介绍了如何使用PDP和DS Log File Viewer的新功能去了解掉电事件,如果它们真的发生在您的机器人上的话。
roboRIO掉电保护
roboRIO使用分阶段的掉电保护方案来尝试稳定自身和其他控制系统组件的输入电压,以防止在大电流消耗的情况下,电池电压拉的过低而导致设备复位。
阶段1 - 6v输出下降
触发电压 - 6.8V
When the voltage drops below 6.8V, the 6V output on the PWM pins will start to drop.
阶段2 - 输出禁用
触发电压 - 6.3V
当电压降至6.3V以下时,控制器将进入掉电保护状态。当进入该状态时,会有下列指示:
roboRIO上的电源LED指示灯将变为琥珀色
Driver Station上的电压显示背景将变为红色
Driver Station上的显示模式将转变为“电压不足”
DS的CAN / Power选项卡会将12V故障计数器加1。
DS将在DS日志中记录一次掉电事件。
控制器将采取以下步骤来尝试保持电池电压:
PWM输出将被禁用。对于已设置中性值的PWM输出(WPILib中的所有电机控制器),在禁用输出之前,将发送一个中性脉冲。
禁用6V,5V,3.3V用户轨(包括PWM引脚上的6V输出,DIO连接器组中的5V引脚,模拟组中的5V引脚,SPI和I2C组中的3.3V引脚以及MXP bank中的5V和3.3V引脚)
配置为输出的GPIO进入High-Z模式
继电器输出被禁用(设为低电平)
向基于CAN的电机控制器发送明确的禁用指令
Pneumatic Devices such as the CTRE Pneumatics Control Module and REV Pneumatic Hub are disabled
控制器将保持此状态,直到电压上升至大于7.5V或降至触发下一阶段的掉电的电压
阶段3-装置停电
**触发电压 - 4.5V **
低于4.5V时,设备可能会停电。确切的停电电压可能低于此电压,这取决于设备的负载。
控制器将保持断电状态,直到电压升高到4.65V以上。这时设备将按正常顺序启动。
避免掉电 - 主动规划电流使用

避免掉电的关键是主动规划机器人的电流消耗。最好的方法是创建某种形式的功率预算。这种预算可能是相当复杂的时间和对应的预计电流消耗的量化,以便在比赛结束时全面了解电流使用情况和电池状态;也可以是简单地关于电流使用的清单。为创建功率预算:
Establish the max “sustained” current draw (with sustained being loosely defined here as not momentary). This is probably the most difficult part of creating the power budget. The exact current draw a battery can sustain while maintaining a voltage of 7+ volts is dependent on a variety of factors such as battery health (see this article for measuring battery health) and state of charge. As shown in the NP18-12 data sheet, the terminal voltage chart gets very steep as state of charge decreases, especially as current draw increases. This datasheet shows that at 3CA continuous load (54A) a brand new battery can be continuously run for over 6 minutes while maintaining a terminal voltage of over 7V. As shown in the image above (used with permission from Team 234s Drive System Testing document), even with a fresh battery, drawing 240A for more than a second or two is likely to cause an issue. This gives us some bounds on setting our sustained current draw. For the purposes of this exercise, we’ll set our limit at 180A.
列出机器人的不同功能,例如动力传动系统,操纵器,主要游戏机制等。
Start assigning your available current to these functions. You will likely find that you run out pretty quickly. Many teams gear their drivetrain to have enough torque to slip their wheels at 40-50A of current draw per motor. If we have 4 motors on the drivetrain, that eats up most, or even exceeds, our power budget! This means that we may need to put together a few scenarios and understand what functions can (and need to be) be used at the same time. In many cases, this will mean that you really need to limit the current draw of the other functions if/while your robot is maxing out the drivetrain (such as trying to push something). Benchmarking the “driving” current requirements of a drivetrain for some of these alternative scenarios is a little more complex, as it depends on many factors such as number of motors, robot weight, gearing, and efficiency. Current numbers for other functions can be done by calculating the power required to complete the function and estimating efficiency (if the mechanism has not been designed) or by determining the torque load on the motor and using the torque-current curve to determine the current draw of the motors.
如果您在分析中确定了互斥功能,请考虑在在软件中加强体现。您还可以在机器人程序中使用PDP电流监控(下面将详细介绍)来动态设置输出限制或排除(例如,当传动系统电流超过X时不要运行机械马达,或者当传动系统电流超过Y时仅让马达半功率运行)。
Settable Brownout
The NI roboRIO 1.0 does not support custom brownout voltages. It is fixed at 6.3V as mentioned in Stage 2 above.
The NI roboRIO 2.0 adds the option for a software settable brownout level. The default brownout level (Stage 2) of the roboRIO 2.0 is 6.75V.
RobotController.setBrownoutVoltage(7.0);
frc::RobotController::SetBrownoutVoltage(7_V);
Measuring Current Draw using the PDP/PDH
The FRC® Driver Station works in conjunction with the roboRIO and PDP/PDH to extract logged data from the PDP/PDH and log it on your DS PC which is visible in the Driver Station Log Viewer
Teams can also use their robot code and manual logging, a LabVIEW front panel or the SmartDashboard to visualize current draw on their robot as mechanisms are developed. In LabVIEW, you can read the current on a PDP/PDH channel using the Get PD Currents VI found on the Power pallet. For C++ and Java teams, use the PowerDistribution class as described in the Power Distribution article. Plotting this information over time (easiest with a LV Front Panel or with the SmartDashboard by using a Graph indicator can provide information to compare against and update your power budget or can locate mechanisms which do not seem to be performing as expected (due to incorrect load calculation, incorrect efficiency assumptions, or mechanism issues such as binding).
备注
Only the CTRE PDP and Rev PDH have built-in current logging. The CTRE PDP 2.0 and AndyMark AMPD do not have current measurment capabilities, and teams would need to implement their own method of logging the current draw. Most CAN motor controllers have current sensors that can be used for this.
识别掉电

识别掉电的最简单方法是单击DS的CANPower选项卡,然后检查12V故障计数。或者,您可以在发现掉电后使用Driver Station Log Viewer查看Driver Station Log。该日志将用亮橙色线标识掉电情况,如上图所示(请注意,这些掉电是由台式电源引起的,可能无法反映通常发生的FRC机器人掉电的持续时间和行为)。