gpt4 book ai didi

linux - 在 Linux 上使用遥测连接到车辆

转载 作者:太空宇宙 更新时间:2023-11-04 10:12:29 24 4
gpt4 key购买 nike

我在连接车辆时遇到问题。首先,即使使用 USB,我也无法连接到车辆(我使用“/dev/ttyUSB0”连接字符串并出现错误)。后来我让它与连接字符串一起工作 '/dev/serial/by-id/usb-3D_Robotics_PX4_FMU_v2.x_0-if00' 并且能够发送命令和接收响应。现在我想用连接到笔记本电脑 USB 的遥测 block 来测试它。我尝试了同样的方法 - 使用连接字符串 "/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0",但它给出了超时消息。

USB 连接测试输出:

>>> PreArm: Check FS_THR_VALUE
>>> PreArm: Throttle below Failsafe
>>> APM:Copter V3.5.4 (284349c3)
>>> PX4: 0384802e NuttX: 1bcae90b
>>> Frame: QUAD
>>> PX4v3 0035003B 3136510A 34313630
Mode: STABILIZE
Autopilot Firmware version: APM:Copter-3.5.4
Autopilot capabilities (supports ftp): False
Global Location: LocationGlobal:lat=40.3985757,lon=49.8104986,alt=38.7
Global Location (relative altitude): LocationGlobalRelative:lat=40.3985757,lon=49.8104986,alt=38.7
Local Location: LocationLocal:north=None,east=None,down=None
Attitude: Attitude:pitch=-0.013171303086,yaw=0.0626983344555,roll=-0.0145587390289
Velocity: [-0.01, -0.01, 0.03]
GPS: GPSInfo:fix=3,num_sat=5
Groundspeed: 0.0168827120215
Airspeed: 0.263999998569
Gimbal status: Gimbal: pitch=None, roll=None, yaw=None
Battery: Battery:voltage=0.0,current=None,level=None
EKF OK?: False
Last Heartbeat: 0.967473479002
Rangefinder: Rangefinder: distance=None, voltage=None
Rangefinder distance: None
Rangefinder voltage: None
Heading: 3
Is Armable?: False
System status: STANDBY
Mode: STABILIZE
Armed: False

我正在打开这样的连接:

vehicle = connect('/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0', wait_ready=True)

这导致以下回溯:

>>> Link timeout, no heartbeat in last 5 seconds
>>> No heartbeat in 30 seconds, aborting.
Traceback (most recent call last):
File "x.py", line 6, in <module>
vehicle = connect('/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0', wait_ready=True)
File "/home/seyid/.local/lib/python2.7/site-packages/dronekit/__init__.py", line 2845, in connect
vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)
File "/home/seyid/.local/lib/python2.7/site-packages/dronekit/__init__.py", line 2117, in initialize
raise APIException('Timeout in initializing connection.')
dronekit.APIException: Timeout in initializing connection.

遥测 block 在使用 MavProxy 时工作。

这里有什么问题?谢谢

最佳答案

有几个问题会导致 dronekit 因连接超时而失败:

  • 确保您安装了 pyserial 模块。

  • 明确指定连接的波特率,如:

    vehicle = connect('/dev/ttyUSB0',
    wait_ready=True,
    baud=57600,
    )

如果使用 mavproxy 连接到同一个串行端口在您的系统上正常工作,那么第二个可能是罪魁祸首。

关于linux - 在 Linux 上使用遥测连接到车辆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48168953/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com