mirror of
https://gitee.com/yyz_o/bk_bishe_pi.git
synced 2025-09-07 23:21:26 +00:00
2025.5.18第二次提交,重新写一份复杂的,慢一些的turn函数
This commit is contained in:
47
bot_code_turn/maze_func.h
Normal file
47
bot_code_turn/maze_func.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
/*---PART1---*/
|
||||
/*---以下为递归算法探索部分涉及到的函数声明---*/
|
||||
bool check_mark(); //检查单元格各方面是否已被确认
|
||||
void maze_entry(int x, int y, int dir, int open); //maze_entry函数,用于写入到wall数组中,1:有墙 0:通路
|
||||
bool unmarked(int y, int x, int dir); //检查该方向是否已被标记
|
||||
void explore(); //递归函数
|
||||
/*---以上为递归算法探索部分涉及到的函数声明---*/
|
||||
|
||||
/*---PART2---*/
|
||||
/*---以下为pid控制和行驶部分涉及到的函数声明---*/
|
||||
void xneighbor(int x, int dir); //X坐标更新
|
||||
void yneighbor(int y, int dir); //Y坐标更新
|
||||
void eI_xianfu(); //对PID控制的积分部分I限幅
|
||||
void pid_speed_xianfu(); //对PID控制的输出部分限幅
|
||||
void PID_AL(); //位置式PID算法
|
||||
void PIDStraight(); //PID控制下的直线行驶
|
||||
void go_to(int dir); //行驶到指定单元格
|
||||
void BOTturn(int turn); //自定义转向函数
|
||||
/*---以上为pid控制和行驶部分涉及到的函数声明---*/
|
||||
|
||||
/*---PART3---*/
|
||||
/*---以下为洪水填充算法部分涉及到的函数声明---*/
|
||||
void flood(int *map, int *copy_wall); //洪水填充算法
|
||||
/*---以上为洪水填充算法部分涉及到的函数声明---*/
|
||||
|
||||
/*---PART4---*/
|
||||
/*---以下为路径算法部分涉及到的函数声明---*/
|
||||
void build_path(int i, int j, int len, int *path, int *map, int *copy_wall); //路径算法
|
||||
void drive_path(int len, int *path); //移动到目的地
|
||||
/*---以上为路径算法部分涉及到的函数声明---*/
|
||||
|
||||
/*---PART5---*/
|
||||
/*---以下为数组构建部分涉及到的函数声明---*/
|
||||
void array_negative_one(int size, int *arr); //将数组初始化为-1
|
||||
void array_copy_mark(int size_x, int size_y, int *copy_mark); //复制一份mark数组,便于后续频繁读取提升性能
|
||||
void array_copy_wall(int size_x, int size_y, int *copy_wall); //复制一份wall数组,便于后续频繁读取提升性能
|
||||
/*---以上为数组构建部分涉及到的函数声明---*/
|
||||
|
||||
/*---PART6---*/
|
||||
/*---以下为数组打印部分涉及到的函数声明---*/
|
||||
void output_arr2D(int size_x, int size_y, int *arr); //打印所有二维数组数组
|
||||
void output_arrwall(int size_x, int size_y, int *arr); //打印wall数组
|
||||
void output_arrpath(int size, int *arr); //打印path数组
|
||||
/*---以上为数组打印部分涉及到的函数声明---*/
|
||||
|
||||
Reference in New Issue
Block a user