2025.5.18第二次提交,重新写一份复杂的,慢一些的turn函数

This commit is contained in:
Ñõԭ×Ó
2025-05-18 11:55:43 +08:00
parent df42d6ce7f
commit 1155ae6f6d
15 changed files with 1005 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
#pragma once
#include<vector>
/*---声明数据---*/
/*---声明全局常量---*/
extern const int DIST_cell; //单元格长度
extern const int DIST_move; //移动的单元格距离
extern const int DIST_wall_F; //与前面墙壁的距离
extern const int DIST_wall_RL; //与左右墙壁的距离
/*---声明全局变量---*/
/*---声明全局容器---*/
extern std::vector<std::vector<int>> mark; //声明mark容器二维容器
extern std::vector<std::vector<std::vector<int>>> wall; //声明wall容器三维容器
/*---声明机器人坐标---*/
extern int rob_x0; //机器人起点X坐标
extern int rob_y0; //机器人起点Y坐标
extern int rob_x; //机械人当前X坐标
extern int rob_y; //机器人当前Y坐标
extern int rob_dir; //机器人当前的朝向
/*---各种全局量声明结束---*/
/*---递归算法---*/
/*---PID算法---*/
extern const float Kp, Ki, Kd; //声明PID的参数
//~ extern float Kpid; //定义PID计算后输出的倍率
extern int Kpid_speed; //定义计算后的速度
extern const float Kpid_base; //定义速度基础倍数速度
extern const int speed_l; //定义左轮基本速度
//~ extern const int speed_r; //定义右轮基本速度
extern int speed_r; //定义右轮基本速度
extern const int speed_xianfu; //kpid输出速度的限幅
extern int err, err_old, err_sum, err_diff; //定义误差,上一次误差,积分误差,微分误差
extern const int eI_max; //定义积分限幅
/*---目标点坐标---*/
extern const int target_x; //声明目标点的X坐标
extern const int target_y; //声明目标点的Y坐标
/*---声明结束---*/