12
返回列表

131

阿木币

0

精华

272 小时

在线时间

管理员

Rank: 9Rank: 9Rank: 9

发表于 2020-8-10 16:36:18
wilsonleong 发表于 2020-8-5 15:43
我从sd卡拿到的ulg文件,发现:
1. vehicle_angular_velocity大概45~50hz
2. vehicle_attitude大概20hz

日志采集肯定会降频,目前飞控的CPU使用率,基本都在40%以上,一般CPU使用率在30%比较合理,日志记录不参与控制,肯定会降频。

扫一扫浏览分享
我不为己,谁人为我,但我只为己,那我又是谁?
回复 点赞

使用道具 举报

0

阿木币

2

精华

76 小时

在线时间

老司机

Rank: 2

 楼主| 发表于 2020-8-11 20:59:17

本帖最后由 wilsonleong 于 2020-8-11 21:05 编辑

[quote]https://bbs.amovlab.com/forum.php?mod=redirect&goto=findpost&ptid=1324&pid=5305[/quote] EKF2中update和predict是跑在两个不同的频率上的,update的频率是之前提过的IMU下采样的频率,而predict是IMU的硬件频率(也可能是Pixhawk的硬件频率)。再看飞机的状态:姿态的更新是跑在predict的频率下,只要有新的IMU数据,就会更新姿态并输出;位置和速度是跑在update的频率下的,也就是下采样的IMU频率,完成了一次EKF2的更新才会输出一次位置和速度;角速度可以直接从陀螺仪获取。

看代码:

ekf.cpp

bool Ekf::update()
{
        bool updated = false;

        if (!_filter_initialised) {
                _filter_initialised = initialiseFilter();

                if (!_filter_initialised) {
                        return false;
                }
        }

        // Only run the filter if IMU data in the buffer has been updated
        if (_imu_updated) {
                // perform state and covariance prediction for the main filter
                predictState();
                predictCovariance();

                // control fusion of observation data
                controlFusionModes();

                // run a separate filter for terrain estimation
                runTerrainEstimator();

                updated = true;

                // run EKF-GSF yaw estimator
                runYawEKFGSF();
        }

        // the output observer always runs
        // Use full rate IMU data at the current time horizon
        calculateOutputStates();

        return updated;
}

ekf2_main.cpp(省略不少)

void Ekf2::Run()
{
        sensor_combined_s sensors;

        if (_sensors_sub.update(&sensors)) {

                _ekf.setIMUData(imu_sample_new);

                // publish attitude immediately (uses quaternion from output predictor)
                publish_attitude(sensors, now);

                // run the EKF update and output
                perf_begin(_ekf_update_perf);
                const bool updated = _ekf.update();
                perf_end(_ekf_update_perf);

                if (updated) {
                        // only publish position after successful alignment
                        if (control_status.flags.tilt_align) {

                                // publish vehicle local position data
                                _vehicle_local_position_pub.update();

                                // publish vehicle odometry data
                                _vehicle_odometry_pub.publish(odom);
                        }
                }

                // publish ekf2_timestamps
                _ekf2_timestamps_pub.publish(ekf2_timestamps);
        }
}
捕获.PNG
回复 点赞

使用道具 举报

0

阿木币

0

精华

182 小时

在线时间

技术大V

Rank: 4

发表于 2020-8-11 22:25:39
wilsonleong 发表于 2020-8-11 20:59
[md]EKF2中update和predict是跑在两个不同的频率上的,update的频率是之前提过的IMU下采样的频率,而predi ...

在mavlink_main.cpp中给参数unlimited,我一般认为这就是最大的更新频率了
回复 点赞

使用道具 举报

0

阿木币

2

精华

76 小时

在线时间

老司机

Rank: 2

 楼主| 发表于 2020-8-12 10:32:15
chasing 发表于 2020-8-11 22:25
在mavlink_main.cpp中给参数unlimited,我一般认为这就是最大的更新频率了

我是初学者,不太懂mavlink。但是mavlink的频率和内部uORB的频率是一回事么?
回复 点赞

使用道具 举报

0

阿木币

2

精华

76 小时

在线时间

老司机

Rank: 2

 楼主| 发表于 2020-8-12 10:38:20
chasing 发表于 2020-8-11 22:25
在mavlink_main.cpp中给参数unlimited,我一般认为这就是最大的更新频率了

请问unlimited具体又是多少hz呢?
回复 点赞

使用道具 举报

0

阿木币

0

精华

182 小时

在线时间

技术大V

Rank: 4

发表于 2020-8-12 18:14:10
wilsonleong 发表于 2020-8-12 10:38
请问unlimited具体又是多少hz呢?

unlimited,数据有更新就发送啊~
回复 点赞

使用道具 举报

12
返回列表
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表