Compare commits

..

2 Commits

11 changed files with 243 additions and 43 deletions

View File

@@ -20,7 +20,7 @@ void go_to(int dir); //行驶到指定单元格
/*---PART3---*/
/*---以下为洪水填充算法部分涉及到的函数声明---*/
void flood(int *map, int *copy_map, int *copy_wall); //洪水填充算法
void flood(int *map, int *copy_wall); //洪水填充算法
/*---以上为洪水填充算法部分涉及到的函数声明---*/
/*---PART4---*/
@@ -31,7 +31,7 @@ void drive_path(int len, int *path); //移动到目的地
/*---PART5---*/
/*---以下为数组构建部分涉及到的函数声明---*/
void array_negative_one(int *arr); //将数组初始化为-1
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数组便于后续频繁读取提升性能
/*---以上为数组构建部分涉及到的函数声明---*/
@@ -40,6 +40,6 @@ void array_copy_wall(int size_x, int size_y, int *copy_wall); //复制一份wa
/*---以下为数组打印部分涉及到的函数声明---*/
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 *arr); //打印path数组
void output_arrpath(int size, int *arr); //打印path数组
/*---以上为数组打印部分涉及到的函数声明---*/

View File

@@ -27,17 +27,14 @@ void array_copy_wall(int size_x, int size_y, int *copy_wall)
{
for(int k = 0; k < 2; k++)
{
copy_wall[i * (size_y + 1) * 2 + j * 2 + k] = wall[i][j][k];
copy_wall[i * (size_y + 1) * 2 + j * 2 + k] = wall[i][j][k]; //注释k = 0记录的是单元格下方的数据1记录的是单元格左边的数据所以转为一维数组后i*...+j*...+k,k=1为左侧数据k=0为下方墙壁。
}
}
}
}
/*---将二维数组初始化为-1---*/
void array_negative_one(int *arr)
void array_negative_one(int size, int *arr) //将数组初始化为-1
{
int size = sizeof(arr) / sizeof(arr[0]); //获取X轴长度
for (int i = 0; i < size; i++)
{
arr[i] = -1;

View File

@@ -1,19 +1,17 @@
#include<iostream>
#include<string>
#include<vector>
#include<cstddef>
#include"eyebot++.h"
#include"maze_parameter.h"
#include"maze_func.h"
using namespace std;
void flood(int *map, int *copy_map, int *copy_wall)
void flood(int *map, int *copy_wall)
{
int num = 0;
int size_x = mark.size();
int size_y = mark[0].size();
map[0] = 0;
copy_map[0] = 0;
do
{
@@ -61,13 +59,5 @@ void flood(int *map, int *copy_map, int *copy_wall)
}
}
}
// for (int i = 0; i < size_x; i++)
// {
// for (int j = 0; j < size_y; j++)
// {
// map[(i * size_y) + j] = copy_map[(i * size_y) + j];
// }
// }
} while (map[(target_x * size_y) + target_y] == -1 && num < (size_x * size_y));
} while (map[((target_x - 1) * size_y) + (target_y - 1)] == -1 && num < (size_x * size_y));
}

View File

@@ -1,6 +1,5 @@
#include<iostream>
#include<string>
#include<vector>
#include"eyebot++.h"
#include"maze_parameter.h"
#include"maze_func.h"

View File

@@ -1,8 +1,6 @@
#include<iostream>
#include<string>
#include<vector>
#include"eyebot++.h"
#include"maze_parameter.h"
#include"maze_func.h"
using namespace std;
@@ -11,7 +9,6 @@ using namespace std;
/*---打印数组mark,map,copy_map等二维数组所用的函数---*/
void output_arr2D(int size_x, int size_y, int *arr)
{
for (int i = size_y - 1; i >= 0; i--)
{
for (int j = 0; j < size_x; j++)
@@ -25,7 +22,6 @@ void output_arr2D(int size_x, int size_y, int *arr)
/*---打印数组wall---*/
void output_arrwall(int size_x, int size_y, int *arr)
{
for (int i = size_y; i >= 0; i--)
{
for (int j = 0; j <= size_x; j++)
@@ -52,11 +48,8 @@ void output_arrwall(int size_x, int size_y, int *arr)
}
}
/*---打印数组path---*/
void output_arrpath(int *arr)
void output_arrpath(int size, int *arr)
{
int size = sizeof(arr) / sizeof(arr[0]);
for (int i = 0; i < size; i++)
{
cout << arr[i] << " ";

View File

@@ -1,7 +1,6 @@
#include<iostream>
#include<string>
#include<vector>
#include<cstddef>
#include"eyebot++.h"
#include"maze_parameter.h"
#include"maze_func.h"

View File

@@ -1,6 +1,5 @@
#include<iostream>
#include<string>
#include<vector>
#include"eyebot++.h"
#include"maze_parameter.h"
#include"maze_func.h"

View File

@@ -1,7 +1,6 @@
#include<iostream>
#include<string>
#include<vector>
#include<cstddef>
#include"eyebot++.h"
#include"maze_parameter.h"
#include"maze_func.h"
@@ -27,21 +26,17 @@ int main()
output_arrwall(mazesize_x, mazesize_y, copy_wall); //打印墙壁wall信息
int map[mazesize_x * mazesize_y] = {}; //创建最短路径求解地图并初始化为0
int copy_map[mazesize_x * mazesize_y] = {}; //创建copy复制地图并初始化为0
array_negative_one(mazesize_x * mazesize_y, map); //将map数组初始化为-1
array_negative_one(map); //将map数组初始化为-1
array_negative_one(copy_map); //将copy_map数组初始化为-1
flood(map, copy_map, copy_wall); //洪水填充算法
flood(map, copy_wall); //洪水填充算法
output_arr2D(mazesize_x, mazesize_y, map); //打印map的数组信息
const int len = map[(target_x * mazesize_y) + target_y]; //迷宫的终点(人为确定)
const int len = map[((target_x - 1) * mazesize_y) + (target_y -1)]; //迷宫的终点(人为确定)
int path[len] = {}; //创建最短路径结果地图并初始化为0
build_path(target_x, target_y, len, path, map, copy_wall); //构建出最短路径path数组
build_path(target_x - 1, target_y - 1, len, path, map, copy_wall); //构建出最短路径path数组
drive_path(len, path); //移动到指定目标点
output_arrpath(path); //打印path数组信息及小车每一步的行驶方向
output_arrpath(len, path); //打印path数组信息及小车每一步的行驶方向
}

View File

@@ -1,10 +1,9 @@
#include<iostream>
#include<string>
#include<vector>
#include<cstddef>
#include"eyebot++.h"
#include"maze_parameter.h"
#include"maze_func.h"
// #include"maze_func.h"
using namespace std;
/*---定义数据---*/

8
文件/eyebot函数.cpp Normal file
View File

@@ -0,0 +1,8 @@
OSWait();
PSDGetRaw();
MOTORDriveRaw();
VWSetSpeed();
VWGetPosition();
VWSetPosition();
VWWait();

221
文件/终端常用.ini Normal file
View File

@@ -0,0 +1,221 @@
[eyesim]
#切换到project路径下:
cd /cygdrive/d/桌面/sync同步文件夹/sync同步文件夹/本科毕设/bk_bishe/eyesim/project
cd /cygdrive/d/桌面/sync同步文件夹/sync同步文件夹/本科毕设/bk_bishe/eyesim/all_test01
cd /cygdrive/d/桌面/sync同步文件夹/sync同步文件夹/本科毕设/bk_bishe/编写代码
cd /cygdrive/d/桌面/sync同步文件夹/sync同步文件夹/本科毕设/bk_bishe/C++功能测试/arr_ test/
#编译PID:
g++sim PIDmain.cpp PID.cpp -o maze.x
#编译递归探索部分:
g++sim maze_main.cpp maze_explore.cpp -o maze.x
[树莓派]
#关机:
sudo halt
#编译:
gccarm myfile.cpp -o myfile.x
[git]
#查看:
git gelper#查看所有的git命令
##---从远程仓库克隆/获取---##
git clone <repo> #从远程仓库克隆代码
git clone -b 分支名 地址 #克隆分支代码到本地
git clone <repo> <directory>#将代码内容克隆到指定目录
参数:
repo :仓库地址
directory:本地目录
例如:
git clone git://github.com/schacon/grit.git
git clone git://github.com/schacon/grit.git mygrit # 克隆到指定本地目录
# 不同协议的仓库地址
git clone http://github.com/CosmosHua/locate new --HTTP协议
git clone git://github.com/CosmosHua/locate new --GIT协议
git clone https://github.com/fsliurujie/test.git --HTTPS协议
##---添加文件到暂存区(追踪文件)---##
# 添加指定文件到暂存区
git add 文件名
# 提交多个文件到暂存区
git add 文件1,文件2
# 将所有文件提交到暂存区
git add .
# 一个文件分多次提交
git add -p 文件名
##---提交文件到本地仓库---##
# 全部提交到本地仓库
git commit
# 提交指定文件到本地仓库
git commit
# 添加提交备注信息,在提交文件后立马用
git commit -m "提交的备注信息"
# 将工作区修改或删除的文件提交到本地版本库,新增的文件不会被提交
git commit -am "备注信息"
# 修改最新一条提交记录的提交原因
git commit --amend - m "提交原因"
# 将当前文件改动提交到HEAD或当前分支的历史ID
git commit -C HEAD
注: 在 Linux 系统中,'commit 信息使用单引号 ',"Windows 系统,commit 信息使用双引号 "。
##---远程操作---##
git remote -v # 查看远程版本库信息
git branch -r # 查看远程分支信息
git remote show <remote> # 查看远程版本库信息
git remote add <remote> <url> # 添加远程版本库,<remote>是给远程仓库命名通常是origin
git fetch <remote> # 从远程代码库获取最新代码(不合并到本地分支)
git pull <remote> <branch> # 获取最新代码并快速合并
git push <remote> <branch> # 上传代码并快速合并,<branch>是指将代码上传到该分支上
git push <remote> :<branch/tag-name> # 删除远程分支或标签
git push origin --delete <分支名称/标签名称> # 删除远程分支或标签
git push -tags # 上传所有标签
##---查看修改历史---##
# 查看指定文件的修改历史
git blame 文件名
# 从100行开始到110行 逐行查看文件的修改历史
git blame -L 100,10 文件名
##打开图形化工具##
gitk
##删除文件##
# 将文件从暂存区和工作区删除
git rm 文件名
# 删除之前修改过并且已经放到暂存区域的话,则必须要用强制删除选项 -f
git rm -f 文件名
# 只删除暂存区的文件,工作区保留
git rm --cached 文件名
# 清除缓存区
git rm -r --cached .
##---git回退操作---##
git reset [--soft | --mixed | --hard] [HEAD]
# --soft 指针移动的时候工作区内容不变重置git commit提交
【简单来说就是取消commit操作提交过的文件恢复到暂存区】
# --mixed 为默认可以省略该参数指针移动重置git add、git commit操作
【简单来说就是取消add和commit操作将提交的内容恢复到暂存区再将暂存区的内容恢复到工作区】
# --hard 指针移动,工作区、暂存区内容删除,回到上一个提交的版本
【简单来说就是HEAD指针移动到指定版本后之后其后面版本的工作区、、缓存区内容全部清除】
# 回退一个版本,将已提交的内容恢复到暂存区,不影响工作区的文件(未提交的也不受影响)
git reset HEAD^ --soft
# 回退一个版本,重置暂存区的文件与上一次的提交(commit)保持一致,不影响原来工作区(未提交的也不受影响)
git reset HEAD^
# 或者写成
git reset HEAD^ --mixed
# 回退一个版本,清空暂存区,将上个版本的内容完全替代本地工作区版本内容
git reset HEAD^ --hard
# 回退到该次提交id的位置 并将回撤内容保存在暂存区
git reset --soft commitID
# 将本地的状态回退到和远程仓库的一样
git reset --hard origin/master
# 从仓库回退到暂存区
git reset --files
# 所有内容都回撤完了后将回撤后的内容强制推送到远程分支
git push -f -u origin 分支名
##---回退n个版本---##
git reset HEAD # 表示当前版本
git reset HEAD^ # 回退1个版本
git reset HEAD^^ # 回退2个版本
git reset HEAD^^^ # 回退3个版本
...
# 回退n个版本
git reset HEAD~n
# 或者
git reset HEAD^n
##---分支---##
# 新建分支
git branch 分支名
# 查看当前所有本地分支
git branch
# 切换分支
git checkout 分支名
# 创建并切换分支
git checkout -b 分支名
# 还原这个文件到对应的commitId的版本
git checkout commitId 文件名(文件路径下的文件名)
# 查看本地当前分支以及提交hash值和commit信息
git branch -v
# 查看全部分支(列出远程分支以及本地分支名 远程分支会以remote/origin/分支名这种形式展示 红色标识)
git branch -a
# 查看带有最后提交id、最近提交原因等信息的本地版本库分支列表
git branch -vv
# 列出远程分支(远程所有分支名)
git branch -r
# 合并指定分支到当前分支
git merge 指定分支名
# 把其他分支的某一次提交内容合并到当前分支
git cherry-pick commitId
# 删除本地分支
git branch -d 分支名
# 分支未提交到本地版本库前强制删除分支
git branch -D 分支名
# 修改分支名
git branch -m 旧分支名 新分支名
# 修改分支名 M强制修改 若与其他分支有冲突也会创建(慎用)
git branch -M 旧分支名 新分支名
# 删除远程版本库上的分支
git push origin --delete <分支名称>
git push origin :<分支名称>
# 将本地分支与远程分支相关联
git push -u origin <本地分支名称>