Technology Sharing

ArduPilot open source code AP_VisualOdom_MAV

2024-07-08

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

1. Origin

Continue studying"ArduPilot Open Source Flight Control AP_VisualOdom"aboutAP_VisualOdom_MAVEquipment class.

Apart from"ArduPilot open source code AP_VisualOdom_Backend"In addition to abstracting shared methods and data, let's further study the function implementation caused by device differences.

2. Class Definition

This C code defines a class AP_VisualOdom_MAV, which inherits from AP_VisualOdom_Backend

class AP_VisualOdom_MAV : public AP_VisualOdom_Backend
{
public:
    // 构造函数,使用从AP_VisualOdom_Backend继承的构造函数
    using AP_VisualOdom_Backend::AP_VisualOdom_Backend;

    // 处理姿态估计数据,将其发送给EKF。距离单位为米
    // Parameters:
    // - remote_time_us: Remote timestamp in microseconds
    // - time_ms: Local timestamp in milliseconds
    // - x, y, z: Position coordinates in meters
    // - attitude: Quaternion representing attitude (orientation)
    // - posErr: Position error
    // - angErr: Angular error
    // - reset_counter: Counter for reset events
    // - quality: Quality of pose estimate (-1 for failed, 0 for unknown, 1 to 100 for varying levels of quality)
    void handle_pose_estimate(uint64_t remote_time_us, uint32_t time_ms, float x, float y, float z, const Quaternion