Author: Yanzhen Zhu
Affiliation: DynamicX
Maintainer:YanzhenZhu, [email protected]
This is all the code of the power management module used by all the robots in dynamicx team. The main task of the power management module is to redistribute and manage the power path of the robot chassis. Because the competition rules allow the use of super capacitor, the main function of the module is to distribute electric energy to charge the super capacitor, so that the super capacitor can generate more than 200W power to the robot chassis when needed, so that the robot can obtain better mobility.
Keywords: Power manager, Over Power, RoboMaster
- IDE: CLion 2022.3.2 - CL-223.8617.54
- Compiler: gcc-arm-none-eabi 10.3.1 20210824
- Debugger: OpenOCD 0.12.0 (2023-01-14-23:37)
- MCU: STM32H750VBT6 with 128KB Flash & 1MB RAM
- Normal Mode: Charge with a constant power or a power proportional to the maximum power, and the remaining power is directly supplied to the chassis through the high side switch. Due to the direct supply chassis, the energy loss of this mode is the smallest.
- OverPower Mode: All power is supplied to the capacitor for charging. After boosting the capacitor to 26V, it is supplied to the chassis. The efficiency of this mode is only about 85%, but it can provide super power output of about 200W in a short time.
- NoCharge Mode: All power is supplied directly to the chassis through the high side switch. Due to the direct supply chassis, the energy loss of this mode is the smallest.
- SucapTest Mode: Turn off all outputs to the chassis and charge the capacitor bank with full power. This status is only used during recording.
- Halt Mode: Turn off the capacitor charging module, turn off the capacitor boost module and turn off the high side switch. At this time, the input, output and capacitor bank are completely disconnected for the mode of robot death or overload protection.
There are three optimization schemes for different scenarios:
- Charge priority: When the power of the capacitor bank is not full, charge the capacitor bank with 15% limited power. at this time, only 85% of the limited power of the chassis can be used. When the power of the capacitor bank exceeds 95%, it will switch to the non charging mode, and all power will be supplied to the chassis.
- Use priority: When the power of the capacitor bank is greater than 10%, the state machine works in the super power state, and the output power can reach 200W. When the power of the capacitor bank is less than 10%, it will be switched to the non charging mode, and all power will be supplied to the chassis.
- Normal: Under this optimization scheme, the capacitor bank is not charged, and all power will be given to the chassis.
- Sucap Test: Charge the super capacitor with full power and enter the halt mode after it is fully charged until NUC sends information and switches to other modes.
Since the measured power of the referee system (hereinafter referred to as "actual power") is
inconsistent with the measured power of the power management (hereinafter referred to as "measured power"), the power
management will correct the power at the initial stage of power on. The power correction scheme uses polynomial to fit
the function between the actual power and the measured power.
There are two fitting methods: simple fitting and complex fitting, both of which are fitted by
the least square method. Simple fitting samples are taken in the range of 10 ~ 40W and fitted with a primary function.
The complex fitting is sampled in the range of 10 ~ 130W and fitted with quadratic function.
For fitting conic by least square method, according to the definition of least square method:
You can write a recurrence formula:
Please report bugs and request features using the Issue Tracker