mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
更新雷达车文档
This commit is contained in:
@@ -23,7 +23,7 @@ And in addition to controlling the car's flexible front, rear, left and right mo
|
||||
|
||||
## Protocol for CarBottomBoard
|
||||
|
||||
*Protocol Format:Data Header(command type) + Data Packet + Data Tail*
|
||||
*Protocol Format: Data Header ( command type ) + Data Packet + Data Tail*
|
||||
|
||||
|Control Target| Protocol Format | Example | Function |
|
||||
|:-------------:|:------------------------------------: |:---:|:---:|
|
||||
@@ -41,9 +41,9 @@ And in addition to controlling the car's flexible front, rear, left and right mo
|
||||
|
||||
- The size of LidarBot: 142mm x 117mm x 120mm
|
||||
- Communication Parameter
|
||||
- M5Core(CarMain) <-> Lidar(GPIO16 <-> Lidar)
|
||||
- M5Core(CarMain) <-> Lidar (<mark>**U1RXD**(GPIO16)</mark> <-> Lidar)
|
||||
Serial Configuration: "230400bps, 8, n, 1"(8 bits data, no parity, 1 stop bit)
|
||||
- M5Core(CarMain) <-> CarBottomBoard(GPIO17 <-> Lidar)
|
||||
- M5Core(CarMain) <-> CarBottomBoard (<mark>**U2TXD**(GPIO17)</mark> <-> Lidar)
|
||||
Serial Configuration: "115200bps, 8, n, 1"(8 bits data, no parity, 1 stop bit)
|
||||
- PinMap
|
||||
- ServoMotor0 <-> A0(MEGA328)
|
||||
@@ -161,6 +161,10 @@ void loop()
|
||||
|
||||
## Related Video
|
||||
|
||||
**Lidar Bot patrols the maze**
|
||||
**LidarBOT Case - following line in the maze**
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/vwzqqE8cL4I" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
<iframe height=498 width=510 src='https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201901/lidarbot.mp4' frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
**LidarBOT Case - walking the maze**
|
||||
|
||||
<iframe height=498 width=510 src='https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201902/LidarBOT%20%20walking%20the%20maze.mp4' frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
@@ -24,7 +24,7 @@ ESP-NOWを利用したリアルタイム通信により、リモコンでLidarBO
|
||||
|
||||
## プロトコル (CarBottomBoard)
|
||||
|
||||
*データフォーマット:データヘッダ(コマンドタイプ) + データパケット + データテール*
|
||||
*データフォーマット: データヘッダ ( コマンドタイプ ) + データパケット + データテール*
|
||||
|
||||
|制御対象 | フォーマット | 例 | 関数 |
|
||||
|:-------------:|:------------------------------------: |:---:|:---:|
|
||||
@@ -42,8 +42,8 @@ ESP-NOWを利用したリアルタイム通信により、リモコンでLidarBO
|
||||
|
||||
- LidarBot サイズ: 142mm x 117mm x 120mm
|
||||
- 通信仕様
|
||||
- M5Core(CarMain) <-> Lidar(GPIO16 <-> Lidar) Serial設定: "230400bps, 8, n, 1"(8 bits data, no parity, 1 stop bit)
|
||||
- M5Core(CarMain) <-> CarBottomBoard(GPIO17 <-> Lidar) Serial設定: "115200bps, 8, n, 1"(8 bits data, no parity, 1 stop bit)
|
||||
- M5Core(CarMain) <-> Lidar(<mark>**U1RXD**(GPIO16)</mark> <-> Lidar) Serial設定: "230400bps, 8, n, 1"(8 bits data, no parity, 1 stop bit)
|
||||
- M5Core(CarMain) <-> CarBottomBoard(<mark>**U2TXD**(GPIO17)</mark> <-> Lidar) Serial設定: "115200bps, 8, n, 1"(8 bits data, no parity, 1 stop bit)
|
||||
- ピンマップ
|
||||
- ServoMotor0 <-> A0(MEGA328)
|
||||
- ServoMotor1 <-> A1(MEGA328)
|
||||
@@ -160,6 +160,10 @@ void loop()
|
||||
|
||||
## 関連動画
|
||||
|
||||
**Lidar Bot 迷路パトロール**
|
||||
**LidarBOT 事件 - 迷路を走る**
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/vwzqqE8cL4I" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
<iframe height=498 width=510 src='https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201901/lidarbot.mp4' frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
**LidarBOT 事件 - 迷路を歩く**
|
||||
|
||||
<iframe height=498 width=510 src='https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201902/LidarBOT%20%20walking%20the%20maze.mp4' frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
+37
-29
@@ -8,27 +8,31 @@
|
||||
|
||||
## 描述
|
||||
|
||||
**<mark>LidarBot</mark>**是一款以室内导航为基础的四轮小车。车体装载了激光雷达、四个麦克纳姆轮、车轮控制低板(主控芯片是MEGA328)、前后RGB灯带(共16颗)、M5Core主控、多个LEGO孔。车与远程遥控手柄之间通过ESP-NOW实时通信,而小车主控接收到控制信号后,通过规定的协议格式实现控制车轮和RGB灯带等。除了能控制小车灵活地前后左右移动之外,还能在小车主控和手柄主控各自的显示屏上显示室内地形。
|
||||
**<mark>LidarBot</mark>** 是一款以室内导航为基础的四轮小车。车体装载了激光雷达、四个麦克纳姆轮、车轮控制低板 ( 主控芯片是 MEGA328 )、前后 RGB 灯带 ( 共 16 颗 )、M5Core 主控、多个 LEGO 孔。
|
||||
|
||||
车与远程遥控手柄之间通过 ESP-NOW 实时通信,而小车主控接收到控制信号后,通过规定的协议格式实现控制车轮和RGB灯带等。
|
||||
|
||||
除了能控制小车灵活地前后左右移动之外,还能在小车主控和手柄主控各自的显示屏上显示室内地形。
|
||||
|
||||
## 特性
|
||||
|
||||
- 雷达: 8m @ 6Hz
|
||||
- 支持Arduino编程
|
||||
- 兼容LEGO件
|
||||
- 支持 Arduino 编程
|
||||
- 兼容 LEGO 件
|
||||
|
||||
## 小车主控与底板之间的协议
|
||||
|
||||
*协议格式:帧头(命令类型)+数据帧+帧尾*
|
||||
*协议格式:帧头 ( 命令类型 ) + 数据帧 + 帧尾*
|
||||
|
||||
| 协议对象 | 协议格式 | 举例 |调用函数|
|
||||
| :-------------: |:------------------------------------: |:---:|:---:|
|
||||
| 控制车轮 | 0xAA,SpeedX(-7 ~ 7),SpeedY,SpeedZ,SpeedA,0x55 | 0xAA, 5, 5, 5, 5, 0x55(前进,速度5) |ControlWheel(5, 5, 5)|
|
||||
| 控制单颗RGB | 0xAB,LedIndex,R(0 ~ 254),G,B,0x55 | 0xAB, 3, 20, 50, 100, 0x55(第三颗灯亮指定颜色)|setLedColor(3, 20, 50, 100)|
|
||||
| 控制前向RGB灯带 | 0xAC,R(0 ~ 254),G,B,0x55 | 0xAC, 20, 50, 100, 0x55(前向灯带亮指定颜色)|setFrontLedBar(20, 50, 100)|
|
||||
| 控制后向RGB灯带 | 0xAD,R(0 ~ 254),G,B,0x55 |0xAD, 20, 50, 100, 0x55(后向灯带亮指定颜色)|setBackLedBar(20, 50, 100)|
|
||||
| 控制全部RGB | 0xAE,R(0 ~ 254),G,B,0x55 |0xAE, 20, 50, 100, 0x55(全部灯亮指定颜色)|setLedAll(20, 50, 100)|
|
||||
| 控制舵机0 | 0xAF,Angle(0 ~ 180),0x55 |0xAF, 100, 0x55(舵机0转动100度)|setServo0Angle(100)|
|
||||
| 控制舵机1 | 0xB0,Angle(0 ~ 180),0x55 |0xB0, 100, 0x55(舵机1转动100度)|setServo1Angle(100)|
|
||||
| 控制单颗 RGB | 0xAB,LedIndex,R(0 ~ 254),G,B,0x55 | 0xAB, 3, 20, 50, 100, 0x55(第三颗灯亮指定颜色)|setLedColor(3, 20, 50, 100)|
|
||||
| 控制前向 RGB 灯带 | 0xAC,R(0 ~ 254),G,B,0x55 | 0xAC, 20, 50, 100, 0x55(前向灯带亮指定颜色)|setFrontLedBar(20, 50, 100)|
|
||||
| 控制后向 RGB 灯带 | 0xAD,R(0 ~ 254),G,B,0x55 |0xAD, 20, 50, 100, 0x55(后向灯带亮指定颜色)|setBackLedBar(20, 50, 100)|
|
||||
| 控制全部 RGB | 0xAE,R(0 ~ 254),G,B,0x55 |0xAE, 20, 50, 100, 0x55(全部灯亮指定颜色)|setLedAll(20, 50, 100)|
|
||||
| 控制舵机 0 | 0xAF,Angle(0 ~ 180),0x55 |0xAF, 100, 0x55(舵机0转动100度)|setServo0Angle(100)|
|
||||
| 控制舵机 1 | 0xB0,Angle(0 ~ 180),0x55 |0xB0, 100, 0x55(舵机1转动100度)|setServo1Angle(100)|
|
||||
|
||||
<img src="assets/img/product_pics/app/lidarbot_04.jpg" width="300" height="300">
|
||||
|
||||
@@ -36,15 +40,15 @@
|
||||
|
||||
- 小车车身尺寸(长宽高):142mm x 117mm x 120mm
|
||||
- 通信参数
|
||||
- 车体的M5Core主控与激光雷达传感器(雷达TXD <-> U2RXD(GPIO16))
|
||||
串口参数:230400bps,8位数据位,无奇偶校验,1位停止位
|
||||
- 车体的M5Core主控与车轮控制底板(底板RXD <-> U2TXD(GPIO17))
|
||||
串口参数:115200bps,8位数据位,无奇偶校验,1位停止位
|
||||
- 车体的 M5Core 主控与激光雷达传感器(雷达 TXD <-> <mark>**U1RXD**(GPIO16)</mark>)
|
||||
串口参数:230400bps,8 位数据位,无奇偶校验,1 位停止位
|
||||
- 车体的 M5Core 主控与车轮控制底板(底板 RXD <-> <mark>**U2TXD**(GPIO17)</mark>)
|
||||
串口参数:115200bps,8 位数据位,无奇偶校验,1 位停止位
|
||||
|
||||
- 接口
|
||||
- 舵机0 <-> A0(MEGA328)
|
||||
- 舵机1 <-> A1(MEGA328)
|
||||
- RGB灯条 <-> 11(MEGA328)
|
||||
- 舵机 0 <-> A0(MEGA328)
|
||||
- 舵机 1 <-> A1(MEGA328)
|
||||
- RGB 灯条 <-> 11(MEGA328)
|
||||
|
||||
<img src="assets/img/product_pics/app/lidarbot_05.jpg" width="300" height="300">
|
||||
|
||||
@@ -52,9 +56,9 @@
|
||||
|
||||
- 1x 雷达车
|
||||
- 1x 远程遥控手柄
|
||||
- 2x 电池(1300mAh @ 11.1V)
|
||||
- 2x 电池 (1300mAh @ 11.1V)
|
||||
- 1x 电池充电器
|
||||
- 1x Type-C USB线
|
||||
- 1x Type-C USB 线
|
||||
|
||||
<img src="assets/img/product_pics/app/lidarbot_02.jpg" width="300" height="300">
|
||||
|
||||
@@ -69,13 +73,13 @@
|
||||
|
||||
*如果需要完整例程请点击[这里](https://github.com/m5stack/Applications-LidarBot/tree/master/LidarBot/Example)。*
|
||||
|
||||
**Example目录树**
|
||||
**Example 目录树**
|
||||
|
||||
├─LidarBot_CarMain_V1.1 - 雷达车主控程序
|
||||
|
||||
├─LidarBot_RemoteController_V1.0 - 遥控手柄程序V1.0
|
||||
├─LidarBot_RemoteController_V1.0 - 遥控手柄程序 V1.0
|
||||
|
||||
└─LidarBot_RemoteController_V1.2 - 遥控手柄程序V1.2(相比V1.0精度提高一倍)
|
||||
└─LidarBot_RemoteController_V1.2 - 遥控手柄程序 V1.2(相比 V1.0 精度提高一倍)
|
||||
|
||||
#### 程序解析:
|
||||
|
||||
@@ -85,9 +89,9 @@
|
||||
/* 主循环 */
|
||||
void loop()
|
||||
{
|
||||
espnow.BotConnectUpdate();// ESPNOW断开重连/换设备重连
|
||||
espnow.BotConnectUpdate();// ESPNOW 断开重连/换设备重连
|
||||
lidarcar.MapDisplay();// 显示地图
|
||||
esp_now_send(espnow.peer_addr, lidarcar.mapdata, 180);// ESPNOW发送地图数据
|
||||
esp_now_send(espnow.peer_addr, lidarcar.mapdata, 180);// ESPNOW 发送地图数据
|
||||
}
|
||||
```
|
||||
|
||||
@@ -100,7 +104,7 @@ void loop()
|
||||
LidarCar lidarcar;
|
||||
|
||||
lidarcar.Init();
|
||||
GetData();//得到雷达保存到数组distance[]
|
||||
GetData();//得到雷达保存到数组 distance[]
|
||||
```
|
||||
|
||||
* 循迹的使用
|
||||
@@ -109,8 +113,8 @@ void loop()
|
||||
#include "rprtrack.h"
|
||||
Rprtrack rprtrack;
|
||||
|
||||
SensorStatus();// 巡线数值保存到数组sensorValue[]
|
||||
CalTrackDev();// 处理数组sensorValue[],得出小车偏移情况,保存至变量OffsetLine
|
||||
SensorStatus();// 巡线数值保存到数组 sensorValue[]
|
||||
CalTrackDev();// 处理数组 sensorValue[],得出小车偏移情况,保存至变量OffsetLine
|
||||
```
|
||||
|
||||
* ESP_NOW的使用
|
||||
@@ -155,6 +159,10 @@ void loop()
|
||||
|
||||
## 相关视频
|
||||
|
||||
**Lidar Bot 在迷宫中巡线**
|
||||
**LidarBOT 案例 - 在迷宫中巡线**
|
||||
|
||||
<iframe height=498 width=510 src='https://player.youku.com/embed/XNDAyODEzMDQ2MA==' frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
<iframe height=498 width=510 src='https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201901/lidarbot.mp4' frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
**LidarBOT 案例 - 走迷宫**
|
||||
|
||||
<iframe height=498 width=510 src='https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201902/LidarBOT%20%20walking%20the%20maze.mp4' frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
Reference in New Issue
Block a user