0

我需要帮助弄清楚如何在自动模式下设置地速(这显然是用 Mavlink 命令“MAV_CMD_DO_CHANGE_SPEED”实现的——但我找不到任何例子)。我认为会起作用的:

vehicle.commands.add(Command( 0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_DO_CHANGE_SPEED, 0, 0, 1, 0.25, 0, 0, 0, 0, 0))

基于: https ://pixhawk.ethz.ch/mavlink/ 和 https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/common.xml

但它不起作用。

谁能帮我吗?

4

3 回答 3

0

以下将起作用:

speed_type = 1  # 0 is airspeed (for plane with airspeed sensor), 1 is groundspeed
speed = 15
throttle_setting = 0
cmds.add( Command( 0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_DO_CHANGE_SPEED, 0, 0, speed_type, speed, throttle_setting, 0, 0, 0, 0) )

您可以通过运行代码然后连接到 GCS 并从车辆下载任务来仔细检查它。

于 2020-01-17T12:30:25.870 回答
0

在将模式设置为 AUTO 之前,您可以将参数“WPNAV_SPEED”设置为所需的速度(以厘米为单位)。像这样的东西:

vehicle.parameters['WPNAV_SPEED'] = 500    
于 2016-09-23T00:16:45.827 回答
0
msg = vehicle.message_factory.command_long_encode(
    0, 0,    # target system, target component
    mavutil.mavlink.MAV_CMD_DO_CHANGE_SPEED, #command
    0, #confirmation
    0, #speed type, ignore on ArduCopter
    speed, # speed
    0, 0, 0, 0, 0 #ignore other parameters
    )

# send command to vehicle
vehicle.send_mavlink(msg)
vehicle.flush()
于 2016-07-20T02:09:26.387 回答