更新 Docs/2024-10-25/README.md
parent
228db69f53
commit
cf577ac897
|
@ -4,19 +4,19 @@ Arduino
|
|||
|
||||
创建项目:
|
||||
|
||||
![1](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/src/branch/main/Docs/2024-10-25/image/img1.png)
|
||||
![1](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img1.png)
|
||||
|
||||
测试代码:
|
||||
|
||||
![2](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/src/branch/main/Docs/2024-10-25/image/img2.png)
|
||||
![2](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img2.png)
|
||||
|
||||
虽说不用选端口,还是存一下,以免日后要用:
|
||||
|
||||
![image-20241019005322216](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/src/branch/main/Docs/2024-10-25/image/img3.png)
|
||||
![image-20241019005322216](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img3.png)
|
||||
|
||||
点击这个,下载并编译:
|
||||
|
||||
![2aaa6101e539345f8b3bb52cc7f991a4](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/src/branch/main/Docs/2024-10-25/image/img4.png)
|
||||
![2aaa6101e539345f8b3bb52cc7f991a4](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img4.png)
|
||||
|
||||
可以看到开发板上指示灯L每隔1秒闪烁1毫秒,是代码中
|
||||
|
||||
|
@ -30,7 +30,7 @@ digitalWrite(13, HIGH);
|
|||
|
||||
digitalWrite(13, LOW);
|
||||
|
||||
![arduino](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/src/branch/main/Docs/2024-10-25/image/img5.webp)
|
||||
![arduino](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img5.webp)
|
||||
|
||||
在Arduino板子上测试,会发现D13引脚指示灯按照程序设定闪烁。
|
||||
|
||||
|
@ -40,19 +40,19 @@ PlatformIO库管理的例子:
|
|||
|
||||
若我们想要使用TimerOne,在调用的时候如果我们没有这个库,就会出现无法调用的错误:
|
||||
|
||||
![image-20241023193533347](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410231935394.png)
|
||||
![image-20241023193533347](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img6.png)
|
||||
|
||||
此时,在platformio.ini中加入下面的代码,然后点击‘√’进行编译,就可以在控制台看到结果。
|
||||
|
||||
![{5AA73C5D-0E01-45d3-8597-174674DD57FE}](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410231945949.png)
|
||||
![{5AA73C5D-0E01-45d3-8597-174674DD57FE}](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img7.png)
|
||||
|
||||
然后,发现库可以正常调用了:
|
||||
|
||||
![{89FCCDBD-97FC-4d14-BBCC-66DF69E3D2AF}](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410231947662.png)
|
||||
![{89FCCDBD-97FC-4d14-BBCC-66DF69E3D2AF}](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img8.png)
|
||||
|
||||
在下面的路径下找到了TimerOne:
|
||||
|
||||
![image-20241023194500197](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410231945275.png)
|
||||
![image-20241023194500197](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img9.png)
|
||||
|
||||
2.SolidWorks安装与使用
|
||||
|
||||
|
@ -117,17 +117,17 @@ PlatformIO库管理的例子:
|
|||
|
||||
如果遇到文章描述的问题,可以参考:[【亲测有效】无法获得下列许可 SOLIDWORKS Standard 无效的(不一致的) 使用许可号码 (-8,544,0)_无法获得下列许可solidworks standard-CSDN博客](https://blog.csdn.net/weixin_41717861/article/details/136000671?ops_request_misc=&request_id=&biz_id=102&utm_term=SolidWorks安装 无效的许可号码-8544&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-136000671.142^v100^pc_search_result_base2&spm=1018.2226.3001.4187)
|
||||
|
||||
![image-20241024011734839](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410240117028.png)
|
||||
![image-20241024011734839](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img10.png)
|
||||
|
||||
安装插件URDFexporter:
|
||||
|
||||
![image-20241024104319660](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410241043698.png)
|
||||
![image-20241024104319660](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img11.png)
|
||||
|
||||
![image-20241024104724792](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410241047875.png)
|
||||
![image-20241024104724792](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img12.png)
|
||||
|
||||
安装成功后,会多出来一个插件:
|
||||
|
||||
![image-20241024104921939](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410241049986.png)
|
||||
![image-20241024104921939](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img13.png)
|
||||
|
||||
3.编码器与PID控制
|
||||
|
||||
|
@ -143,7 +143,7 @@ PlatformIO库管理的例子:
|
|||
|
||||
通过对码盘的各个位置设计特定的编码,可以输出转动轴的绝对位置信息。
|
||||
|
||||
![image-20241024145232819](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410241452871.png)
|
||||
![image-20241024145232819](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img14.png)
|
||||
|
||||
1.每个位置都有唯一的编码值,通常以二进制、十六进制或其他编码方式表示。
|
||||
|
||||
|
@ -157,7 +157,7 @@ PlatformIO库管理的例子:
|
|||
|
||||
脉冲的个数也可以用于表示位移的大小。但是增量式编码器断电后可能会丢失部分信息。
|
||||
|
||||
![image-20241024152622800](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410241526855.png)
|
||||
![image-20241024152622800](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img15.png)
|
||||
|
||||
**2-相脉冲**(Two-phase Pulse)是一种编码器或传感器的输出信号类型,通常用于检测旋转或线性运动的方向和速度。它广泛应用于增量式编码器中。在2-相脉冲信号中,编码器产生两路方波信号,分别称为 **A相** 和 **B相**,并且这两个信号之间有一个90度的相位差。通过比较A相和B相的脉冲顺序,可以确定旋转的方向,而通过计算脉冲数可以得到运动的速度。
|
||||
|
||||
|
@ -167,13 +167,13 @@ PlatformIO库管理的例子:
|
|||
|
||||
编码器的分辨率越高,每转的脉冲数越多,检测的精度也越高。
|
||||
|
||||
![image-20241024152635500](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410241526573.png)
|
||||
![image-20241024152635500](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img16.png)
|
||||
|
||||
3.1.3 4倍频
|
||||
|
||||
**4倍频**指的是控制器在处理编码器信号时,不仅检测每个信号的上升沿或下降沿,而是检测**A相和B相的每一个上升沿和下降沿**,从而将编码器的分辨率提高到4倍。对AB相的上升沿和下降沿均作检测,这样在一个周期内有四种状态:
|
||||
|
||||
![image-20241024153348494](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410241533534.png)
|
||||
![image-20241024153348494](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img17.png)
|
||||
|
||||
在这一个周期中,四个状态按照顺序分别为:
|
||||
|
||||
|
@ -241,4 +241,4 @@ void loop(){
|
|||
|
||||
与文档中的代码不一样,在Interrupt_A()和Interrupt_B()中,更新A/B相信号的代码中使用了‘==’,实际上应该是赋值语句,所以改为了‘A=true’。除此之外,将这两个处理信号的函数设置在setup()之前,保证程序正常编译。
|
||||
|
||||
![image-20241024181003880](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410241810948.png)
|
||||
![image-20241024181003880](http://logzhan.vicp.io:3000/ZhaiShuaiShuai/Report/raw/branch/main/Docs/2024-10-25/image/img18.png)
|
||||
|
|
Loading…
Reference in New Issue