更多...
|
| __init__ (self, portname, baudrate, devnum=0, debug=0) |
| 初始化串口连接,用于与飞控进行 MAVLink 通信。
|
|
| debug (self, s, level=1) |
| 输出调试信息。
|
|
| write (self, b) |
| 向飞控发送字节数据。
|
|
| close (self) |
| 关闭串口连接。
|
|
| read (self, n) |
| 读取指定长度的字节数据。
|
|
|
| _recv (self) |
| 从 MAVLink 中读取字节数据,处理接收到的数据。
|
|
定义一个 MavlinkSerialPort 类,用于通过 MAVLink 进行串口通信
◆ __init__()
__init__ |
( |
| self, |
|
|
| portname, |
|
|
| baudrate, |
|
|
| devnum = 0, |
|
|
| debug = 0 ) |
初始化串口连接,用于与飞控进行 MAVLink 通信。
- 参数
-
portname | 串口名称(如 /dev/ttyUSB0)。 |
baudrate | 串口波特率(常见值如 115200)。 |
devnum | 设备编号,默认为 0。 |
debug | 调试级别,默认为 0。 |
- 返回
- 无返回值。
◆ _recv()
从 MAVLink 中读取字节数据,处理接收到的数据。
- 参数
-
- 返回
- 接收到的字节数据。
从 MAVLink 中读取字节数据
◆ close()
◆ debug()
debug |
( |
| self, |
|
|
| s, |
|
|
| level = 1 ) |
输出调试信息。
- 参数
-
s | 要输出的调试信息字符串。 |
level | 调试级别,默认为 1,决定输出的详细程度。 |
- 返回
- 无返回值。
写入调试文本
◆ read()
◆ write()
该类的文档由以下文件生成: