mavsdk_api

MAVSDK中offboard一些API

Value

其中是offboard需要用到的一些参数定义。

offboard.PositionNedYaw

class mavsdk.offboard.PositionNedYaw(north_m, east_m, down_m, yaw_deg)

Bases: object

Type for position commands in NED (North East Down) coordinates and yaw.

**参数是NED坐标和偏航下的位置命令。**单位是m

  • Parameters:

    north_m (float) – Position North (in metres),单位是米

    east_m (float) – Position East (in metres)

    down_m (float) – Position Down (in metres)

    yaw_deg (float) – Yaw in degrees (0 North, positive is clock-wise looking from above)

offboard.VelocityBodyYawspeed

class mavsdk.offboard.VelocityBodyYawspeed(forward_m_s, right_m_s, down_m_s, yawspeed_deg_s)

Bases: object

Type for velocity commands in body coordinates.

参数是前右下以及偏航的速度命令,单位是m/s。

  • Parameters:

    forward_m_s (float) – Velocity forward (in metres/second)

    right_m_s (float) – Velocity right (in metres/second)

    down_m_s (float) – Velocity down (in metres/second)

    yawspeed_deg_s (float) – Yaw angular rate (in degrees/second, positive for clock-wise looking from above)

offboard.VelocityNedYaw

class mavsdk.offboard.VelocityNedYaw(north_m_s, east_m_s, down_m_s, yaw_deg)

Bases: object

Type for velocity commands in NED (North East Down) coordinates and yaw.

北东地坐标系以及偏航角下的速度命令,单位是m/s。

  • Parameters:

    north_m_s (float) – Velocity North (in metres/second)

    east_m_s (float) – Velocity East (in metres/second)

    down_m_s (float) – Velocity Down (in metres/second)

    yaw_deg (float) – Yaw in degrees (0 North, positive is clock-wise looking from above)

一些offboard的控制API

set_position_ned

async set_position_ned(position_ned_yaw)

Set the position in NED coordinates and yaw.

在NED和偏航中设置位置,参数是position_ned_yaw。

  • Parameters:

    position_ned_yaw (PositionNedYaw) – Position and yaw

  • Raises:OffboardError – If the request fails. The error contains the reason for the failure.

set_position_velocity_ned

async set_position_velocity_ned(position_ned_yaw, velocity_ned_yaw)

Set the position in NED coordinates, with the velocity to be used as feed-forward.

在NED坐标中设置位置,并设置要用作前馈的速度。参数是position_ned_yaw和velocity_ned_yaw

  • Parameters:

    position_ned_yaw (PositionNedYaw) – Position and yaw

    velocity_ned_yaw (VelocityNedYaw) – Velocity and yaw

  • Raises:

    OffboardError – If the request fails. The error contains the reason for the failure.

set_velocity_body

async set_velocity_body(velocity_body_yawspeed)

Set the velocity in body coordinates and yaw angular rate. Not available for fixed-wing aircraft.

**在身体坐标和偏航角速率中设置速度。不适用于固定翼飞机。**参数是velocity_body_yawspeed

  • Parameters:

    velocity_body_yawspeed (VelocityBodyYawspeed) – Velocity and yaw angular rate

  • Raises:

    OffboardError – If the request fails. The error contains the reason for the failure.

set_velocity_ned

async set_velocity_ned(velocity_ned_yaw)

Set the velocity in NED coordinates and yaw. Not available for fixed-wing aircraft.

**在 NED 坐标和偏航中设置速度。不适用于固定翼飞机。**参数是velocity_ned_yaw。

  • Parameters:

    velocity_ned_yaw (VelocityNedYaw) – Velocity and yaw

  • Raises:

    OffboardError – If the request fails. The error contains the reason for the failure.

Offboard基础控制

在使用offboard函数之前,首先要启动offboard,最后使用完后要记得关闭,后面两个函数用来返回信息。

start

async start()

Start offboard control.

启动offboard模式

  • Raises:

    OffboardError – If the request fails. The error contains the reason for the failure.

stop

async stop()

Stop offboard control.

停止offboard模式

The vehicle will be put into Hold mode: https://docs.px4.io/en/flight_modes/hold.html

  • Raises:

    OffboardError – If the request fails. The error contains the reason for the failure.

OffboardError

exception mavsdk.offboard.OffboardError(result, origin, *params)

Bases: Exception

Raised when a OffboardResult is a fail code

当“板外结果”为失败代码时引发

OffboardResult

class mavsdk.offboard.OffboardResult(result, result_str)

Bases: object

Result type.结果类型

  • Parameters:

    result (Result) – Result enum valueresult_str (std::string) – Human-readable English string describing the result

Action API

顺序:arm–>takeoff–>land–>disarm

解锁和上锁

arm

async arm()

disarm

async disarm()

起飞降落

takeoff

async takeoff()

设置起飞高度

async set_takeoff_altitude(altitude)

  • Parameters:

    altitude (float) – Takeoff altitude relative to ground/takeoff location (in meters)

land

async* land()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值