玩转四旋翼无人机(DJI SDK LIB)

本文介绍了如何使用DJI SDK LIB进行四旋翼无人机的控制,包括自动起飞、降落、返航,数据读取,GPS坐标解算,姿态四元数解析以及位置控制。建议开发者以50Hz频率发送姿态控制命令,并详细阐述了在不同GPS信号条件下使用水平位置和速度控制的条件。此外,还讲解了姿态四元数转换为roll, pitch, yaw的计算方法,以及如何通过GPS坐标解算获取飞行器在北东坐标系的位置。" 95425413,5068093,大数据BI工程师的自我修养:报表开发与业务理解,"['数据仓库', '数据开发', 'BI报表', '数据埋点', '业务分析']
摘要由CSDN通过智能技术生成

建议开发者将姿态控制命令以50Hz的频率发送,用户可根据自己的开发环境通过如usleep(20000)ros::Duration(1/50)等方式实现。

typedef struct
{
    signed short yaw_angle;
    signed short roll_angle;
    signed short pitch_angle;
    struct
    {
        unsigned char base : 1;
        unsigned char yaw_cmd_ignore : 1;
        unsigned char roll_cmd_ignore : 1;
        unsigned char pitch_cmd_ignore : 1;
        unsigned char reserve : 4;
    }ctrl_byte;
    unsigned char duration;
}gimbal_custom_control_angle_t;

解释这里使用了bit field方法,为C++11内容,如下:
Declares a class data member with explicit size, in bits. Adjacent bit field members may be packed to share and straddle the individual bytes.
A bit field declaration is a class data member declaration which uses the following declarator:

identifier(optional) attr(optional) : size (1)

The type of the bit field is introduced by the decl-specifier-seq of the declaration syntax.

  1. attr(C++11) - optional sequence of any number of attributes
  2. identifier - the name of the bit field that is being declared. The
    name is optional: nameless bit fields introduce the specified number
    of bits of padding
  3. size - an integral constant expression with a
    value greater or equal to zero. When greater than zero, this is the
    number of bits that this bit field will occupy. The value zero is
    only allowed for nameless bitfields and has special meaning: it
    specifies that the next bit field in the class definition will begin
    at an allocation unit’s boundary.
typedef struct
{
    signed short yaw_angle_rate;
    signed short roll_angle_rate;
    signed short pitch_angle_rate;
    struct
    {
        unsigned char reserve : 7;
        unsigned char ctrl_switch : 1;//decide increment mode or absolute mode
    }ctrl_byte;
}gimbal_custom_speed_t;

/*
 *struct of api contrl
 */

typedef struct
{
    fp32 q0;
    fp32 q1;
    fp32 q2;
    fp32 q3;
}api_quaternion_data_t;//四元数

typedef struct
{
    fp32 x;
    fp32 y;
    fp32 z;
}api_common_data_t;//三维坐标

/*
 *struct of vellocity data
 */

typedef struct
{
    fp32 x;
    fp32 y;
    fp32 z;
    unsigned char health_flag         :1;
    unsigned char feedback_sensor_id  :4;
    unsigned char reserve             :
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值