电机大YAW反馈多了一个Π
This commit is contained in:
parent
a05a69cba5
commit
2377a13dea
@ -71,13 +71,13 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE
|
||||
User/component/user_math.c
|
||||
|
||||
# User/device sources
|
||||
User/device/ai.c
|
||||
User/device/bmi088.c
|
||||
User/device/dr16.c
|
||||
User/device/motor.c
|
||||
User/device/motor_dm.c
|
||||
User/device/motor_rm.c
|
||||
User/device/remote_control.c
|
||||
User/device/ai.c
|
||||
|
||||
# User/module sources
|
||||
User/module/chassis.c
|
||||
@ -87,6 +87,8 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE
|
||||
User/module/shoot.c
|
||||
|
||||
# User/task sources
|
||||
User/task/Task8.c
|
||||
User/task/ai.c
|
||||
User/task/atti_esti.c
|
||||
User/task/chassis.c
|
||||
User/task/cmd.c
|
||||
@ -94,9 +96,8 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE
|
||||
User/task/init.c
|
||||
User/task/rc.c
|
||||
User/task/shoot.c
|
||||
User/task/tempCodeRunnerFile.c
|
||||
User/task/user_task.c
|
||||
User/task/ai.c
|
||||
User/task/Task8.c
|
||||
)
|
||||
|
||||
# Add include paths
|
||||
|
||||
@ -48,7 +48,7 @@ typedef struct
|
||||
struct
|
||||
{
|
||||
|
||||
|
||||
uint8_t head;
|
||||
float ch_l_x; /* 遥控器左侧摇杆横轴值,上为正 */
|
||||
float ch_l_y; /* 遥控器左侧摇杆纵轴值,右为正 */
|
||||
float ch_r_x; /* 遥控器右侧摇杆横轴值,上为正 */
|
||||
@ -63,6 +63,8 @@ typedef struct
|
||||
CMD_SwitchPos_t key_G;
|
||||
CMD_SwitchPos_t key_H;
|
||||
|
||||
|
||||
uint8_t end;
|
||||
int16_t knob_left; // 左旋钮
|
||||
int16_t knob_right; // 右旋钮
|
||||
} __attribute__((packed)) ET16s;
|
||||
|
||||
@ -145,8 +145,8 @@ static const Config_Param_t config = {
|
||||
},
|
||||
|
||||
.pid.yaw_4310_motor_omega = {
|
||||
.k = 0.1f,
|
||||
.p = 0.3f,
|
||||
.k = 0.5f,
|
||||
.p = 0.5f,
|
||||
.i = 0.0f,
|
||||
.d = 0.0f,
|
||||
.i_limit = 0.0f,
|
||||
|
||||
@ -331,24 +331,10 @@ g->setpoint.eulr.pit = g_cmd->set_pitch;
|
||||
/*4310大YAW控制
|
||||
这里是单环控制的,有需要加双环
|
||||
*/
|
||||
// /* 大YAW角度环:使用环形误差,避免过零点抽搐 */
|
||||
// float yaw4310_err = CircleError(
|
||||
// g->setpoint.yaw_4310,
|
||||
// g->feedback.motor.yaw_6020_motor_feedback.rotor_abs_angle,
|
||||
// M_2PI
|
||||
// );
|
||||
// /* 构造等效的包角设定值,使 PID 内部误差=set-ref=环形误差 */
|
||||
// float yaw4310_set_wrapped = g->feedback.motor.yaw_6020_motor_feedback.rotor_abs_angle + yaw4310_err;
|
||||
// yaw_omega_set_point = PID_Calc(
|
||||
// &g->pid.yaw_4310_angle,
|
||||
// yaw4310_set_wrapped,
|
||||
// g->feedback.motor.yaw_6020_motor_feedback.rotor_abs_angle,
|
||||
// g->feedback.motor.yaw_6020_motor_feedback.rotor_speed,
|
||||
// g->dt
|
||||
// );
|
||||
|
||||
yaw_omega_set_point =PID_Calc(&g->pid.yaw_4310_angle,3.90f,
|
||||
g->feedback.motor.yaw_4310_motor_feedback.rotor_abs_angle,g->feedback.motor.yaw_6020_motor_feedback.rotor_speed,g->dt);
|
||||
|
||||
yaw_omega_set_point =PID_Calc(&g->pid.yaw_4310_angle,g->setpoint.yaw_4310,
|
||||
g->feedback.motor.yaw_6020_motor_feedback.rotor_abs_angle,g->feedback.motor.yaw_6020_motor_feedback.rotor_speed,g->dt);
|
||||
|
||||
|
||||
g->out.yaw_4310 = PID_Calc(&g->pid.yaw_4310_omega,yaw_omega_set_point,
|
||||
|
||||
@ -6,8 +6,7 @@
|
||||
/* Includes ----------------------------------------------------------------- */
|
||||
#include "task/user_task.h"
|
||||
/* USER INCLUDE BEGIN */
|
||||
#include "module/cmd.h"
|
||||
#include "bsp/uart.h"
|
||||
|
||||
/* USER INCLUDE END */
|
||||
|
||||
/* Private typedef ---------------------------------------------------------- */
|
||||
@ -15,7 +14,7 @@
|
||||
/* Private macro ------------------------------------------------------------ */
|
||||
/* Private variables -------------------------------------------------------- */
|
||||
/* USER STRUCT BEGIN */
|
||||
CMD_RC_t remote;
|
||||
|
||||
/* USER STRUCT END */
|
||||
|
||||
/* Private function --------------------------------------------------------- */
|
||||
@ -37,10 +36,9 @@ void Task_Task8(void *argument) {
|
||||
while (1) {
|
||||
tick += delay_tick; /* 计算下一个唤醒时刻 */
|
||||
/* USER CODE BEGIN */
|
||||
osMessageQueueGet(task_runtime.msgq.RC_REMOTE, &remote, NULL, 0);
|
||||
// osMessageQueueGet(task_runtime.msgq.RC_REMOTE, &remote, NULL, 0);
|
||||
|
||||
|
||||
BSP_UART_Transmit(BSP_UART_1, (uint8_t *)&remote, sizeof(CMD_RC_t), false);
|
||||
|
||||
|
||||
/* USER CODE END */
|
||||
|
||||
@ -37,7 +37,7 @@ void Task_Init(void *argument) {
|
||||
task_runtime.thread.cmd = osThreadNew(Task_cmd, NULL, &attr_cmd);
|
||||
task_runtime.thread.gimbal = osThreadNew(Task_gimbal, NULL, &attr_gimbal);
|
||||
task_runtime.thread.shoot = osThreadNew(Task_shoot, NULL, &attr_shoot);
|
||||
// task_runtime.thread.ai = osThreadNew(Task_ai, NULL, &attr_ai);
|
||||
task_runtime.thread.ai = osThreadNew(Task_ai, NULL, &attr_ai);
|
||||
task_runtime.thread.Task8 = osThreadNew(Task_Task8, NULL, &attr_Task8);
|
||||
|
||||
// 创建消息队列
|
||||
@ -55,7 +55,7 @@ void Task_Init(void *argument) {
|
||||
task_runtime.msgq.gimbal.ai.feedback = osMessageQueueNew(2u, sizeof(Gimbal_feedback_t),NULL);
|
||||
task_runtime.msgq.gimbal.ai.g_cmd = osMessageQueueNew(2u, sizeof(AI_cmd_t),NULL);
|
||||
task_runtime.msgq.shoot.ai.s_cmd = osMessageQueueNew(2u, sizeof(AI_cmd_t),NULL);
|
||||
task_runtime.msgq.RC_REMOTE = osMessageQueueNew(2u, sizeof(CMD_RC_t), NULL);
|
||||
|
||||
/* USER MESSAGE END */
|
||||
|
||||
osKernelUnlock(); // 解锁内核
|
||||
|
||||
@ -60,9 +60,7 @@ void Task_rc(void *argument) {
|
||||
osMessageQueueReset(task_runtime.msgq.cmd.raw.rc);
|
||||
osMessageQueuePut(task_runtime.msgq.cmd.raw.rc, &cmd_rc, 0, 0);
|
||||
|
||||
osMessageQueueReset(task_runtime.msgq.RC_REMOTE);
|
||||
osMessageQueuePut(task_runtime.msgq.RC_REMOTE, &cmd_rc, 0, 0);
|
||||
|
||||
|
||||
/* USER CODE END */
|
||||
osDelayUntil(tick); /* 运行结束,等待下一次唤醒 */
|
||||
}
|
||||
|
||||
@ -1 +0,0 @@
|
||||
feedback
|
||||
@ -105,7 +105,7 @@ typedef struct {
|
||||
}ai;
|
||||
}shoot;
|
||||
|
||||
osMessageQueueId_t RC_REMOTE;
|
||||
|
||||
} msgq;
|
||||
/* USER MESSAGE END */
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user