You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
4.1 KiB
110 lines
4.1 KiB
/*
|
|
* robot_cv_config.c
|
|
*
|
|
* Created on: 2026年6月10日
|
|
* Author: lapto
|
|
*/
|
|
|
|
#include "robot_cv_config.h"
|
|
|
|
// 全局常量配置表,存放在 Flash/ROM 中,掉电不丢失
|
|
const CV_struct_define g_robotCvTable[MAX_ROBOT_COUNT] = {
|
|
// [0] = { /* 机器人 L2.2-05 (ID=0) 的全套参数 */
|
|
// .MAXSpeed_m_per_min = 20,
|
|
// .LeftTurnSpeed = 40,
|
|
// .RightTurnSpeed = 40,
|
|
// .RobotLeftAngleValue = -9000,
|
|
// .RobotRightAngleValue = 9000,
|
|
// .RobotUpAngleValue = 0,
|
|
// .RobotDownAngleValue = 0,
|
|
// .DMK0_Speed = 0,
|
|
// .Lane_Change_Speed_m_per_min = 4,
|
|
// .IsAutomationAuthorized = 1,
|
|
// .IsFunctionAuthorized = 1,
|
|
// .Joy_Sticker_Angle_Allowance = 45,
|
|
// .Joy_Sticker_Value_Allowance = 600,
|
|
// .Allowable_Error_For_Angle_Tracking = 100,
|
|
// .Horizontal_ChangeLane_Compensation = -5,
|
|
// .Vertical_ChangeLane_Compensation = -1,
|
|
// .wheel_Reduction_Ratio = 101,
|
|
// .wheel_Diameter_m = 0.28,
|
|
// .has_PID_high = true,
|
|
// .PID_high = { .PID_Angle=2500, .Kp = 0.7, .Ki = 0, .Kd = 0.5 }, // PID结构体成员名
|
|
// .has_PID_mid = true,
|
|
// .PID_mid = { .PID_Angle=500, .Kp = 0.3, .Ki = 0, .Kd = 0.1 },
|
|
// .has_PID_low = true,
|
|
// .PID_low = { .PID_Angle=100, .Kp = 0.01, .Ki = 0, .Kd = 0.05 }
|
|
// },
|
|
|
|
// [1] = { /* 机器人 L01-24 (ID=1) 的全套参数 */
|
|
// .MAXSpeed_m_per_min = 20,
|
|
// .LeftTurnSpeed = 40,
|
|
// .RightTurnSpeed = 40,
|
|
// .RobotLeftAngleValue = -9000,
|
|
// .RobotRightAngleValue = 9000,
|
|
// .RobotUpAngleValue = 0,
|
|
// .RobotDownAngleValue = 0,
|
|
// .DMK0_Speed = 0,
|
|
// .Lane_Change_Speed_m_per_min = 4,
|
|
// .IsAutomationAuthorized = 1,
|
|
// .IsFunctionAuthorized = 1,
|
|
// .Joy_Sticker_Angle_Allowance = 45,
|
|
// .Joy_Sticker_Value_Allowance = 600,
|
|
// .Allowable_Error_For_Angle_Tracking = 100,
|
|
// .Horizontal_ChangeLane_Compensation = -5,
|
|
// .Vertical_ChangeLane_Compensation = -1,
|
|
// .wheel_Reduction_Ratio = 101,
|
|
// .wheel_Diameter_m = 0.28,
|
|
// .has_PID_high = true,
|
|
// .PID_high = { .PID_Angle=2500, .Kp = 0.7, .Ki = 0, .Kd = 0.5 }, // PID结构体成员名
|
|
// .has_PID_mid = true,
|
|
// .PID_mid = { .PID_Angle=800, .Kp = 0.3, .Ki = 0, .Kd = 0.2 },
|
|
// .has_PID_low = true,
|
|
// .PID_low = { .PID_Angle=100, .Kp = 0.08, .Ki = 0, .Kd = 0.05 }
|
|
// },
|
|
|
|
[2] = { /* 机器人 BGR L01 (ID=2) 的全套参数 */
|
|
.MAXSpeed_m_per_min = 20,
|
|
.LeftTurnSpeed = 40,
|
|
.RightTurnSpeed = 40,
|
|
.RobotLeftAngleValue = -9000,
|
|
.RobotRightAngleValue = 9000,
|
|
.RobotUpAngleValue = 0,
|
|
.RobotDownAngleValue = 0,
|
|
.DMK0_Speed = 0,
|
|
.Lane_Change_Speed_m_per_min = 4,
|
|
.IsAutomationAuthorized = 1,
|
|
.IsFunctionAuthorized = 1,
|
|
.Joy_Sticker_Angle_Allowance = 45,
|
|
.Joy_Sticker_Value_Allowance = 600,
|
|
.Allowable_Error_For_Angle_Tracking = 100,
|
|
.Horizontal_ChangeLane_Compensation = -5,
|
|
.Vertical_ChangeLane_Compensation = -1,
|
|
.wheel_Reduction_Ratio = 101,
|
|
.wheel_Diameter_m = 0.28,
|
|
.has_PID_high = true,
|
|
.PID_high = { .PID_Angle=2500, .Kp = 0.7, .Ki = 0, .Kd = 0.5 }, // PID结构体成员名
|
|
.has_PID_mid = true,
|
|
.PID_mid = { .PID_Angle=800, .Kp = 0.3, .Ki = 0, .Kd = 0.1 },
|
|
.has_PID_low = true,
|
|
.PID_low = { .PID_Angle=100, .Kp = 0.08, .Ki = 0, .Kd = 0.05 }
|
|
},
|
|
|
|
|
|
|
|
|
|
// 后续机器人直接按 [2], [3] ... 往下加即可
|
|
// 未明确赋值的项会被编译器自动初始化为 0/false
|
|
};
|
|
|
|
/**
|
|
* @brief 根据机器人ID获取预设的CV参数指针
|
|
* @param robotId 机器人编号 (0 ~ MAX_ROBOT_COUNT-1)
|
|
* @return 成功返回参数指针,越界返回 NULL
|
|
*/
|
|
const CV_struct_define* Robot_GetCvConfig(uint8_t robotId) {
|
|
if (robotId >= MAX_ROBOT_COUNT) {
|
|
return NULL;
|
|
}
|
|
return &g_robotCvTable[robotId];
|
|
}
|
|
|