Ardupilot飞控添加使用诺瓦泰GPS

2023-05-16

 

Ardupilot飞控添加使用诺瓦泰双天线GPS航向角的设置

 

一、添加诺瓦泰GPS heading角数据包解析代码

1、打开libraries\AP_GPS\AP_GPS_NOVA.h,添加如下代码:

   struct PACKED heading

    {

        uint32_t solstat;

        uint32_t postype;

        float length;

        float heading;

        float pitch;

        float resv1;

        float hdg_std_dev;

        float ptch_std;

        uint8_t stnID[4];

        uint8_t svstracked;

        uint8_t svslnsolution;

        uint8_t obsmask;

        uint8_t multi;

        uint8_t resv2;

        uint8_t extsolstat;

        uint8_t resv3;

        uint8_t sigmask;

};

在 msgbuffer中作如下修改:

union PACKED msgbuffer {

        bestvel bestvelu;

        bestpos bestposu;

        psrdop psrdopu;

        heading headingu;

        uint8_t bytes[256];

    };

2、打开libraries\AP_GPS\AP_GPS_NOVA.cpp,找到bool AP_GPS_NOVA::process_message(void)函数,添加如下代码:

if (messageid == 971) // heading

    {

        const heading &headingu = nova_msg.data.headingu;

 

        state.heading = (float) (headingu.heading);

        state.last_gps_fixed_time_ms = AP_HAL::millis();

        return false;

    }

同时,在本函数的开始处找到bestpos数据解析,定位到相应的位置并作如下修改:

 if (bestposu.solstat == 0) // have a solution

        {

            switch (bestposu.postype)

            {

                case 16:

                    state.status = AP_GPS::GPS_OK_FIX_3D;

                    state.last_gps_fixed_time_ms = AP_HAL::millis();

                    break;

                case 17: // psrdiff

                case 18: // waas

                case 20: // omnistar

                case 68: // ppp_converg

                case 69: // ppp

                    state.status = AP_GPS::GPS_OK_FIX_3D_DGPS;

                    state.last_gps_fixed_time_ms = AP_HAL::millis();

                    break;

                case 32: // l1 float

                case 33: // iono float

                case 34: // narrow float

                    state.status = AP_GPS::GPS_OK_FIX_3D_RTK_FLOAT;

                    state.last_gps_fixed_time_ms = AP_HAL::millis();

                    break;

                case 48: // l1 int

                case 50: // narrow int

                    state.status = AP_GPS::GPS_OK_FIX_3D_RTK_FIXED;

                    state.last_gps_fixed_time_ms = AP_HAL::millis();

                    break;

                case 0: // NONE

                case 1: // FIXEDPOS

                case 2: // FIXEDHEIGHT

                default:

                    state.status = AP_GPS::NO_FIX;

                    break;

            }

        }

  1. 打开libraries\AP_GPS\AP_GPS.h,找到结构体GPS_State,作如下添加:

struct GPS_State {

        uint8_t instance; // the instance number of this GPS

 

        // all the following fields must all be filled by the backend driver

        GPS_Status status;                  ///< driver fix status

        uint32_t time_week_ms;              ///< GPS time (milliseconds from start of GPS week)

        uint16_t time_week;                 ///< GPS week number

        Location location;                  ///< last fix location

        float ground_speed;                 ///< ground speed in m/sec

        float ground_course;                ///< ground course in degrees

        uint16_t hdop;                      ///< horizontal dilution of precision in cm

        uint16_t vdop;                      ///< vertical dilution of precision in cm

        uint8_t num_sats;                   ///< Number of visible satellites

        Vector3f velocity;                  ///< 3D velocity in m/s, in NED format

        float speed_accuracy;               ///< 3D velocity accuracy estimate in m/s

        float horizontal_accuracy;          ///< horizontal accuracy estimate in m

        float vertical_accuracy;            ///< vertical accuracy estimate in m

        bool have_vertical_velocity:1;      ///< does GPS give vertical velocity? Set to true only once available.

        bool have_speed_accuracy:1;         ///< does GPS give speed accuracy? Set to true only once available.

        bool have_horizontal_accuracy:1;    ///< does GPS give horizontal position accuracy? Set to true only once available.

        bool have_vertical_accuracy:1;      ///< does GPS give vertical position accuracy? Set to true only once available.

        uint32_t last_gps_time_ms;          ///< the system time we got the last GPS timestamp, milliseconds

 

        float heading; //RTKGPS heading

        uint32_t last_gps_fixed_time_ms;

};

并在AP_GPS类的public中添加如下函数:

    // GPS heading in degrees

    float gps_heading(uint8_t instance) const {

        return state[instance].heading;

    }

    int32_t gps_heading() const {

        return gps_heading(primary_instance)*100;

    }

    //get gps fixed time

    uint32_t gps_last_fixed_time(uint8_t instance) const {

        return state[instance].last_gps_fixed_time_ms;

    }

    uint32_t gps_last_fixed_time() const {

        return gps_last_fixed_time(primary_instance);

    }

 

  • 修改yaw漂移修正函数

打开libraries\AP_AHRS\AP_AHRS_DCM.cpp文件,找到void AP_AHRS_DCM::drift_correction_yaw(void)函数,找到else if并将其作如下替换:

else if (have_gps()) {

        //we are using GPS heading for yaw

        if ( _gps.gps_last_fixed_time() != _gps_last_update) {

            yaw_deltat = (_gps.gps_last_fixed_time() - _gps_last_update) * 1.0e-3f;

            _gps_last_update = _gps.gps_last_fixed_time();

 

            new_value = true;

 

            float gps_heading_rad = ToRad(_gps.gps_heading()*0.01f);

            float yaw_error_rad = wrap_PI(gps_heading_rad - yaw);

            yaw_error = sinf(yaw_error_rad);

 

            if (!_flags.have_initial_yaw ||

                    yaw_deltat > 20 ||

                    fabsf(yaw_error_rad) >= 1.047f){

                // reset DCM matrix based on current yaw

                _dcm_matrix.from_euler(roll, pitch, gps_heading_rad);

                _omega_yaw_P.zero();

                _flags.have_initial_yaw = true;

                yaw_error = 0;

            }

        }

}

 

  • 修改AP_AHRS_NavEKF.cpp文件:

打开libraries\AP_AHRS\AP_AHRS_NavEKF.cpp文件,找到 void AP_AHRS_NavEKF::update_EKF2(void)函数,并找到yaw=eulers.z;将其注释掉。//yaw=eulers.z

 

  • 修改AP_NavEKF2_core.cpp文件:

打开libraries\AP_NavEKF2\AP_NavEKF2_core.cpp文件,找到void NavEKF2_core::UpdateFiler(bool predict)函数,定位到SelectMafFusion();在其下面一行添加:调用recordYawReset();函数。

 

  • Ubuntu系统编译飞控代码
  1. 安装git

sudo apt-get install git

2、下载和安装交叉编译工具

wgeth ttps://launchpadlibrarian.net/218827486/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2

tar -xjvf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2

sudo apt-get install lsb-core

  1. 设置环境变量

   export PATH=/home/your user name/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH

4、克隆飞控源码

    git clone https://github.com/ArduPilot/ardupilot.git

    cd ardupilot

git submodule update --init --recursive

5、运行unbuntu系统环境安装工具脚本

Tools/scripts/install-prereqs-ubuntu.sh -y

6、. ~/.profile

7、编译

   cd ArduCopter

   make px4-v2

8、清空编译文件

   make px4-clean

 

  • 烧写固件后参数设置

通过MissonPlanner地面站将编译好的固件ArduCopter-v2.px4(在ArduCopter目录下),烧写到pixhawk飞控板子,然后点击配置(CONFIG/TUNING),选择全部参数树(Full Parameter Tree),点击最右边刷新参数按钮(Refresh Params)。

                              

 

1、使用诺瓦泰GPS的设置

在参数表中,找到GPS,点击“+”号打开,找到GPS_TYPE,将其值设为15(即:使用诺瓦泰GPS),然后点击右边写入参数按钮(Write Params)。

 

  1. 禁用罗盘的设置

同样,在参数表中,找到COMPASS,点击“+”号打开,找到COMPASS_USE,COMPASS_USE2,

COMPASS_USE3,将它们全部设为0(不使用罗盘),然后点击右边写入参数按钮(Write Params)。

 

 

  1. 使用EKF2

 

 

并将EKF3关掉:

 

  • 诺瓦泰GPS输出配置

    1、初始化GPS,执行该命令后GPS波特率变为9600

freset

  2、设置GPS串口波特率为115200

com com2 115200 n 8 1 n off off       

com com1 115200 n 8 1 n off off

  1. 打开双天线测向功能

dualantennaalign enable 5 1

  1. 设置飞控需要的数据

位置信息:

log com1 bestposb ontime 0.2

速度信息:

log com1 bestvelb ontime 0.2

精度因子:

log com1 psrdopb ontime 0.2

航向角信息:

log com1 headingb onchanged

  1. 设置差分格式,与基站保持对应:

INTERFACEMODE COM2 NOVATELX NONE OFF

PSRDIFFTIMEOUT 15

RTKTIMEOUT 10

  1. 保存配置

       saveconfig

 

  • 诺瓦泰GPS接线

GPS的TX接到飞控板子的RX;

GPS的GND接飞控的GND;

GPSRX空置不用。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Ardupilot飞控添加使用诺瓦泰GPS 的相关文章

  • 根据 GPS 坐标计算 PNG 地图上的 X 和 Y 位置

    我正在 iPhone 应用程序上实现自定义地图 尺寸为 map width 和 map height 的图像 并尝试在该地图上显示当前用户位置 current long 和 current lat 我有 2 个参考点 具有已知的 GPS 坐
  • 在 Iphone SDK 中显示 GPS 可用性和准确性

    如何编程以在 iPhone 中显示 GPS 可用性和准确度级别 并且它必须擦除标签中先前的纬度 经度信息 iOS sdk 中有一个类叫做 CLLocationManager 浏览 XCode 中的文档或查找一些示例 http mobileo
  • 谷歌地图可以根据小时分钟秒绘制点吗

    我正在尝试绘制以时分秒秒格式提供给我的 GPS 数据 GLatLng 会采用这种形式吗 还是我需要先转换它 很难在互联网上找到与此相关的任何内容 如果可以采用这种格式 我们将不胜感激 据我所知它不接受这种格式 但转换它真的很容易 只需计算一
  • 如何在 python 中创建自己的数据类型以便覆盖算术运算符?

    我目前正在使用 Python Numpy 处理地理 GPS 数据 喜欢它 并且我面临着计算由坐标对定义的地理点之间的距离的重复任务pn lon lat 我有一个这样使用的函数 dist geodistance p1 p2 它类似于线性代数中
  • 使用 Android.Xamarin 查找纬度和经度

    我正在尝试在 Android Xamarin 中开发商店定位器应用程序 我的第一步是找到我所在位置的纬度和经度 但我的模拟器 设备屏幕没有显示任何内容 我有我的uses permissions set to
  • GPS/GIS 计算:根据运动/每小时预测未来位置的算法?

    寻找资源或算法来在导航应用程序中计算以下内容 如果我当前的 GPS 位置为 0 0 并且我以 15 英里 小时的速度前进 32 度 我如何计算 10 秒后我的位置 i e GPSCoordinate predictedCoord GPSCo
  • GPS坐标:一个点周围1平方公里

    我希望有人能给我提供一个方程来计算给定点周围 1 公里的平方 X 从 a aaa 到 b bbb Y 从 c ccc 到 c ccc 例如lat 53 38292839 and lon 6 1843984 我还需要围绕一个点 2 公里 5
  • Java中的多点三边测量算法

    我正在尝试在我的 Android 应用程序中实现三边测量算法来确定用户的室内位置 我正在使用超宽带信标来获取到固定点的距离 我能够采用中建议的方法三边测量法 Android Java https stackoverflow com ques
  • GPS 坐标(以度为单位)来计算距离

    在iPhone上 我以十进制度数获取用户的位置 例如 纬度39 470920和经度 0 373192 也就是A点 我需要用另一个 GPS 坐标 同样以十进制表示 B 点创建一条线 然后 计算从 A 到 B 的线与另一个点 C 之间的距离 垂
  • 在设备所有者应用程序中启用 GPS

    根据API文档 https developer android com reference android app admin DevicePolicyManager html setSecureSetting android conten
  • 根据 GPS 坐标计算平均速度的最佳实践

    我这里有一个可以给我 GPS 坐标的设备 我可以定义的时间间隔 我想用它来计算驾驶或驾车旅行时的平均速度 实际上 我使用了正交公式来计算两点之间的距离 然后将其除以给定的时间间隔 通过我遵循的实施这个词 http de wikipedia
  • GPS 对比加速度计计算距离

    我正在尝试实现一个健身应用程序 可以在Android 中跟踪跑步速度和跑步距离 看起来我可以使用 GPS 或加速度计来计算这些信息 由于跑步者可能会将手机放在手里 放在肩膀上或放在口袋里 所以我的第一直觉是使用 GPS 获取位置并计算跑步速
  • Google 地图 (Android) 中的位置更新率

    我正在编写一个简单的基于 GPS 的应用程序 用于位置感知 每当启用 GPS 时 应用程序都会请求位置更新并以格式打印纬度和经度 TextView 如果 GPS 被禁用 位置提供商会回退到LocationManager NETWORK PR
  • C# - LINQ - GPS 纬度和经度的最短距离

    我有数据库 其中有带有 GPS 坐标的一流酒店 我想获得距离我选择的坐标最近的地方 我认为它应该看起来像这样 我在这里找到了很多示例代码 就像这样 var coord new GeoCoordinate latitude longitude
  • 在没有互联网的情况下使用 Javascript 获取 GPS 位置 [重复]

    这个问题在这里已经有答案了 您好 如果设备具有 GPS 硬件 我们可以在没有互联网连接的情况下使用 JavaScript 获取 GPS 位置吗 请注意谁将其标记为重复 我需要 JavaScript 在没有互联网连接的情况下工作 并使用 GP
  • Android 中的 GPS 超时

    在黑莓中 我们使用超时来获取位置 这样如果它在这么长时间内没有重新调整位置 我们就会知道 但是在Android中 没有超时的概念 任何人都可以告诉我们替代方案 我们可以发现 在这么长时间之后 GPS没有位置更新 您可以使用两个线程来实现此超
  • 检测wifi是否启用(无论是否连接)

    对于 GPS 跟踪应用程序来说 在打开 WIFI 的情况下记录位置信号会导致数据非常不精确或存在间隙 在开始跟踪之前 我已使用可达性查询来检测 wifi 是否可用 问题是 如果进行该查询时 wifi 已启用但未连接到网络 则表明无法通过 w
  • PWA 可以访问联系人、GPS 或使用手机摄像头吗?

    PWA 可以访问联系人 GPS 或使用手机摄像头吗 这在任何系统 ios android 中都可能吗 是否有任何开发计划来实现这些功能 PWA 无法克服一些限制 you cannot访问电话上的联系人列表 另一方面 你can拍照并使用 GP
  • 如何创建在 React-Native 中检测自动位置的地图

    我已经在react native中创建了地图 参考https github com lelandrichardson react native maps https github com lelandrichardson react nat
  • Ruby on Rails:如何使用 TCP 套接字连接 GPS 设备

    ruby 2 3 0p0 2015 12 25 修订版 53290 x86 64 linux 轨道 4 2 4 我正在使用 cloud9 IDE 和 webrick 服务器 我的项目是实时跟踪GPS 我想使用TCP连接与GPS跟踪设备进行通

随机推荐

  • C语言:函数返回字符串的四种方法

    转载连接 xff1a 1 https blog csdn net turkeyzhou article details 6104135 comments 2 https www cnblogs com qingergege p 649668
  • C语言:字符串中查找指定字符——strchr()和strrchr()

    参考文章连接 xff1a 1 http c biancheng net cpp html 161 html 2 http c biancheng net cpp html 172 html 1 头文件 xff1a include lt st
  • C语言:整型、浮点型和字符串间转换

    参考文章链接 xff1a 1 http c biancheng net cpp html 1573 html 2 http c biancheng net cpp html 1574 html 1 整型 浮点型 gt 字符串 整数转换为字符
  • 学习贵在坚持!

    最近学习颇为不顺 xff0c 周围都是一些不利的消息 xff0c 有些心灰意冷 可是这不是与我写本文的初衷相悖了么 xff1f 看到了比自己优秀的人干出来辉煌的事情 xff0c 写出来文字优美的文章 xff0c 自己就有相形见绌的自卑感 可
  • Qt中 QString 和int, char等的“相互”转换

    原文链接 xff1a https blog csdn net ei nino article details 7297791 Qt中 int float double转换为QString 有两种方法 1 使用QString number 如
  • 计算器第二版:C语言,VC++6.0

    使用栈实现 xff0c 前缀表达式变后缀表达式的原理 xff0c 但是没有转换 xff0c 是边转换边实现 xff1a include lt stdio h gt include lt stdlib h gt include lt coni
  • 计算器第三版:C语言,递归,VC++6.0

    参考文章 xff1a https blog csdn net u011692041 article details 49796343 https blog csdn net u011692041 article details 497991
  • 计算器第四版:C++,QT

    核心算法和第二版一样 xff1a 头文件 xff1a calculate h ifndef CALCULATE H define CALCULATE H include lt QMainWindow gt include lt QPushB
  • USB协议概念学习

    1 USB总线结构 usb的总线拓扑结构如下所示 xff1a 从USB总线结构可以看出 xff0c 主要由3部分组成 xff1a USB主机 Host USB线缆 USB设备 hub Func等 USB主机 xff1a 一般成为USB Ho
  • 创新工场两道笔试题0919

    题目1 字符串去重 xff0c 老题目 xff0c 只是要求不能开辟新空间用来复制原字符串 思路 xff1a 使用布尔型的简单hash表可以节省空间 xff0c 用来存储字符是否出现的信息 xff0c 刚开始hash表里面都是false x
  • ROS仿真机器人学习笔记二:创建4轮小车模型及相关xraco文件修改

    系列文章目录 提示 xff1a 这里可以添加系列文章的所有文章的目录 xff0c 目录需要自己手动添加 例如 xff1a 第一章 Python 机器学习入门之pandas的使用 提示 xff1a 写完文章后 xff0c 目录可以自动生成 x
  • 旧电脑升级Windows11时检查CPU和TPM2.0不满足的解决方案(慎重)

    上个月微软发布了Windows11 22H2正式版 xff0c 不少新电脑也接收到了推送 xff0c 楼主的台式 xff08 i3 8100 军规星H310M xff09 也接收到了推送 xff0c 但是碍于Win11蛋疼的右键和状态栏消息
  • windows下安装docker

    windows下安装docker 0 前置条件 环境说明 xff1a windows11 家庭中文版 开启Hyper V xff08 可以百度如何开启 xff09 如何添加Hyper V 创建hyper txt xff0c 复制如下内容 x
  • STM32CubeMX配置生成FreeRTOS项目

    文章目录 1 安装STM32CubeMX软件1 1 下载安装1 2 安装要用到的芯片软件包 2 配置FreeRTOS项目2 1 创建工程2 2 配置SYS2 3 配置RCC2 4 配置系统运行时钟2 5 配置UART1串口作为调试代码2 6
  • ScrumMaster的教练职责

    ScrumMaster是Scrum团队的敏捷教练 Ken Rubin说 xff0c 类似于运动团队的教练 xff0c ScrumMaster观察团队使用Scrum的过程 xff0c 帮助团队提高工作绩效 教练不是顾问 xff0c 不提供解决
  • Autoware.Auto avp仿真详解

    1 定位 定位节点启动的是 ndt localizer 61 Node package 61 39 ndt nodes 39 executable 61 39 p2d ndt localizer exe 39 namespace 61 39
  • VMware + ubuntu16.04 + ROS kinetic 下配置realsense D435i 遇到的问题

    在配置Realsense D435i 的过程中 xff0c 遇到一个问题 执行 scripts patcg realsebse ubuntu lts sh 下载速度奇慢 10K s左右 而且会在接受到36 的时候不动了 xff0c 等了一晚
  • 白话tensorflow分布式部署和开发

    关于tensorflow的分布式训练和部署 xff0c 官方有个英文的文档介绍 xff0c 但是写的比较简单 xff0c 给的例子也比较简单 xff0c 刚接触分布式深度学习的可能不太容易理解 在网上看到一些资料 xff0c 总感觉说的不够
  • 全息投影技术

    1 概念 全息投影技术 xff08 front projectedholographic display xff09 也称 虚拟成像 技术是利用干涉和衍射原理记录并再现物体真实的 三维 图像的技术 全息投影技术不仅可以产生立体的空中幻像 x
  • Ardupilot飞控添加使用诺瓦泰GPS

    Ardupilot飞控添加使用诺瓦泰双天线GPS航向角的设置 一 添加诺瓦泰GPS heading角数据包解析代码 1 打开libraries AP GPS AP GPS NOVA h xff0c 添加如下代码 xff1a struct P