添加功率控制宏定义

This commit is contained in:
shmily744 2024-03-18 15:21:29 +08:00
parent 229add4878
commit 480363ca1b
1 changed files with 4 additions and 2 deletions

View File

@ -30,6 +30,8 @@
#define HALF_TRACK_WIDTH (TRACK_WIDTH / 2.0f) // 半轮距
#define PERIMETER_WHEEL (RADIUS_WHEEL * 2 * PI) // 轮子周长
#define P_MAX 50.0f //功率控制 单位W
/* 底盘应用包含的模块和信息存储,底盘是单例模式,因此不需要为底盘建立单独的结构体 */
#ifdef CHASSIS_BOARD // 如果是底盘板,使用板载IMU获取底盘转动角速度
#include "can_comm.h"
@ -191,8 +193,8 @@ static void LimitChassisOutput()
motor_rb->motor_controller.motor_power_predict +
motor_lb->motor_controller.motor_power_predict +
motor_lf->motor_controller.motor_power_predict + 3.6f;
float P_max = 60 - 10;
float K = P_max/P_cmd;
float K = P_MAX / P_cmd;
vofa_send_data[2] = P_cmd;
motor_rf->motor_controller.motor_power_scale = K;