diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/PID.md" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/PID.md" new file mode 100644 index 0000000000000000000000000000000000000000..7e82c24b019299b7a66dc7e61cb65de8665d05b4 --- /dev/null +++ "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/PID.md" @@ -0,0 +1,56 @@ +# 小车底盘代码修改 + +## 下载代码 + +```shell +git clone https://gitee.com/HiEuler/eulercar_controller.git +``` + +在`HiSpark Studio`中打开工程,此时工程中会有很多报错,将`c_cpp_properties.json`内的`compilerPath`更改到自己电脑中`HiSpark Studio`安装路径下即可解决 + +
image-20240810164937528image-20240810164455488
+ + +修改`Euler_car.hiproj`中选项,删除`ZDU3061MNPICA`前的`ZDU`,`sdk_path`替换成自己电脑上的路径,修改程序烧录端口号和波特率,在`main.c`中选择正确的电机参数 + +
image-20240810162250427image-20240810162410179image-20240810163823546
+ + +为了使用串口进行调参,要使用串口0,首先在`./user/generatecode/main.h`中声明串口0中断服务函数 + +image-20240810170152582 + +打开`./user/generatecode/system_init.c`,定义串口0中断服务函数,修改`UART0_Init()`,设置串口0接收模式为中断接收,接收`fifo`水线设置为1,使能串口接收中断 + +image-20240810170343639 + +打开`./user/eulercar_control.c`,定义串口调参相关变量、串口0下发数据代码 + +
image-20240814130927265image-20240814131022174
+ +添加串口0中断接收函数和协议解析函数 + +image-20240814142126203 + +将串口0数据发送函数添加到定时器0中断内 + +image-20240814162730458 + +串口0接收解析函数,转速执行函数放在`while(1)`中,将按键功能更改为调整目标速度 + +image-20240814164248792 + +改动后的代码工程下载链接: + +>https://github.com/codingnoobwyh/Eulercar_PID_Params_Tuning.git + +# Qt上位机 + +使用欧拉小车上排针引出的串口0连接电脑,在Qt上位机中打开对应串口,波特率选择115200,使用按键调整预期速度。按下`开始转动`按键,小车电机则开始转动;按下`停止转动`按键,电机停止转动,PID积分项清零。输入框中输入对应参数按下`设定参数`可以调整PID参数 + +
image-20240815131303179image-20240814195148168
+如果发现电机总是满转速转动,可能是不同的小车电机驱动引脚连接相反,在代码中将两个大于号替换为小于号 + +image-20240815133719967 + +image-20240815133749789 diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810162250427.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810162250427.png" new file mode 100644 index 0000000000000000000000000000000000000000..2ddd05d94d14f147612346fd86f9a6f9f39fd58b Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810162250427.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810162410179.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810162410179.png" new file mode 100644 index 0000000000000000000000000000000000000000..5886d682efbab46ba26311966b5fd67d8ea4be08 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810162410179.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810163823546.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810163823546.png" new file mode 100644 index 0000000000000000000000000000000000000000..0fdd4f6faed072f0fd4d65ef403e995e687834b2 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810163823546.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810164455488.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810164455488.png" new file mode 100644 index 0000000000000000000000000000000000000000..d510c2ec22e95bdaa4c540c79171668f1683e2a2 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810164455488.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810164937528.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810164937528.png" new file mode 100644 index 0000000000000000000000000000000000000000..24187a15232fc17de478ec23ae5c972fa73cb834 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810164937528.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810170152582.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810170152582.png" new file mode 100644 index 0000000000000000000000000000000000000000..327213dac0db5e8743f65facb582742d2942bb44 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810170152582.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810170343639.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810170343639.png" new file mode 100644 index 0000000000000000000000000000000000000000..50ad26ef3c3afe252b81c983b01203ef50b80df9 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240810170343639.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814130927265.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814130927265.png" new file mode 100644 index 0000000000000000000000000000000000000000..9344bfebab598c35ce2df2a37bee09b7089cea9b Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814130927265.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814131020763.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814131020763.png" new file mode 100644 index 0000000000000000000000000000000000000000..a09655b35874ae3f0f76ff3610ee1786e30788c6 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814131020763.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814131022174.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814131022174.png" new file mode 100644 index 0000000000000000000000000000000000000000..a09655b35874ae3f0f76ff3610ee1786e30788c6 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814131022174.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814142126203.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814142126203.png" new file mode 100644 index 0000000000000000000000000000000000000000..cfdfbb00e5cc8855248042d593c32560aed0a19b Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814142126203.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814162730458.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814162730458.png" new file mode 100644 index 0000000000000000000000000000000000000000..a27e9b6aafefed9211347c6056e41da8480ccadb Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814162730458.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814163540747.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814163540747.png" new file mode 100644 index 0000000000000000000000000000000000000000..006543059b986b722374a27bfc0878d63ffd405a Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814163540747.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814164248792.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814164248792.png" new file mode 100644 index 0000000000000000000000000000000000000000..5c4abc33427e3a8efd23d96c2dde9c91b868a1d8 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814164248792.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814195148168.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814195148168.png" new file mode 100644 index 0000000000000000000000000000000000000000..547f63c9a03fa252ffa6bb76afdaa0a75c6bfd2e Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240814195148168.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815131303179.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815131303179.png" new file mode 100644 index 0000000000000000000000000000000000000000..084e4f65ddbe86552a24d1e2359c7af861b30690 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815131303179.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815131305888.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815131305888.png" new file mode 100644 index 0000000000000000000000000000000000000000..084e4f65ddbe86552a24d1e2359c7af861b30690 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815131305888.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815133719967.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815133719967.png" new file mode 100644 index 0000000000000000000000000000000000000000..6bd7a96d4f86768e007223d0197f9afd85398a0d Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815133719967.png" differ diff --git "a/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815133749789.png" "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815133749789.png" new file mode 100644 index 0000000000000000000000000000000000000000..f159b214f158c58309e41482fa7fc404abdac9a7 Binary files /dev/null and "b/PID\350\260\203\345\217\202\346\226\271\346\241\210/images/image-20240815133749789.png" differ