mavlink / mavros

MAVLink to ROS gateway with proxy for Ground Control Station
Other
847 stars 983 forks source link

Bugs of frame transformation for local_position/pose and setpoint_position/local #1946

Open ZhongmouLi opened 2 months ago

ZhongmouLi commented 2 months ago

I find the pose information of a drone is different is the mavlink message (ATTITUDE) and mavros/local/pose.

I was flying an ArduCopter in the guided mode. It is required to call the takeoff service before we can send position setpoints to setpoint_position/local. Lets say the target position is 1, 0, takeoff height, then I find the drone rotate 90 degrees in yaw before it performs translation. So, I guess there maybe be something wrong in frame transformation.

In order to verify that, I run ArduCopter in simulation, and I find even when I just begin the simulation, the yaw angle of the drone is 90 degrees in local_position/pose, Screenshot from 2024-04-15 20-53-15

while at the same time, the mavlink message ATTITUDE shows 0 in yaw angle

Screenshot from 2024-04-15 20-53-56

After making it takeoff for 5m, I use mavproxy to make the drone move 10m forwards, which is shown as 10m movement in y direction from mavros/local/pose. Screenshot from 2024-04-15 20-55-54

Therefore, I believe the frame translation is wrong.

MAVROS version and platform

Mavros: 1.17 ROS: Noetic Ubuntu: 20.04

Autopilot type and version

[X] ArduPilot [ ] PX4

Version: 4.4.0

Node logs

copy output of mavros_node. Usually console where you run roslaunch

Diagnostics

place here result of:
header: 
  seq: 1316
  stamp: 
    secs: 1713185885
    nsecs: 774314695
  frame_id: ''
status: 
  - 
    level: 0
    name: "mavros: FCU connection"
    message: "connected"
    hardware_id: "udp://127.0.0.1:14551@:14551"
    values: 
      - 
        key: "Received packets:"
        value: "29246"
      - 
        key: "Dropped packets:"
        value: "0"
      - 
        key: "Buffer overruns:"
        value: "0"
      - 
        key: "Parse errors:"
        value: "0"
      - 
        key: "Rx sequence number:"
        value: "220"
      - 
        key: "Tx sequence number:"
        value: "0"
      - 
        key: "Rx total bytes:"
        value: "7894980"
      - 
        key: "Tx total bytes:"
        value: "564864"
      - 
        key: "Rx speed:"
        value: "6580.000000"
      - 
        key: "Tx speed:"
        value: "460.000000"
  - 
    level: 0
    name: "mavros: GPS"
    message: "3D fix"
    hardware_id: "udp://127.0.0.1:14551@:14551"
    values: 
      - 
        key: "Satellites visible"
        value: "10"
      - 
        key: "Fix type"
        value: "6"
      - 
        key: "EPH (m)"
        value: "1.21"
      - 
        key: "EPV (m)"
        value: "2.00"
  - 
    level: 1
    name: "mavros: Mount"
    message: "Can not diagnose in this targeting mode"
    hardware_id: "udp://127.0.0.1:14551@:14551"
    values: 
      - 
        key: "Mode"
        value: "255"
  - 
    level: 0
    name: "mavros: Heartbeat"
    message: "Normal"
    hardware_id: "udp://127.0.0.1:14551@:14551"
    values: 
      - 
        key: "Heartbeats since startup"
        value: "1754"
      - 
        key: "Frequency (Hz)"
        value: "0.999991"
      - 
        key: "Vehicle type"
        value: "Quadrotor"
      - 
        key: "Autopilot type"
        value: "ArduPilot"
      - 
        key: "Mode"
        value: "GUIDED"
      - 
        key: "System status"
        value: "Active"
  - 
    level: 0
    name: "mavros: System"
    message: "Normal"
    hardware_id: "udp://127.0.0.1:14551@:14551"
    values: 
      - 
        key: "Sensor present"
        value: "0x5771FC2F"
      - 
        key: "Sensor enabled"
        value: "0x5361FC2F"
      - 
        key: "Sensor health"
        value: "0x5771FC2F"
      - 
        key: "3D gyro"
        value: "Ok"
      - 
        key: "3D accelerometer"
        value: "Ok"
      - 
        key: "3D magnetometer"
        value: "Ok"
      - 
        key: "absolute pressure"
        value: "Ok"
      - 
        key: "GPS"
        value: "Ok"
      - 
        key: "3D angular rate control"
        value: "Ok"
      - 
        key: "attitude stabilization"
        value: "Ok"
      - 
        key: "yaw position"
        value: "Ok"
      - 
        key: "z/altitude control"
        value: "Ok"
      - 
        key: "x/y position control"
        value: "Ok"
      - 
        key: "motor outputs / control"
        value: "Ok"
      - 
        key: "rc receiver"
        value: "Ok"
      - 
        key: "AHRS subsystem health"
        value: "Ok"
      - 
        key: "Terrain subsystem health"
        value: "Ok"
      - 
        key: "Logging"
        value: "Ok"
      - 
        key: "Battery"
        value: "Ok"
      - 
        key: "pre-arm check status. Always healthy when armed"
        value: "Ok"
      - 
        key: "propulsion (actuator, esc, motor or propellor)"
        value: "Ok"
      - 
        key: "CPU Load (%)"
        value: "0.0"
      - 
        key: "Drop rate (%)"
        value: "0.0"
      - 
        key: "Errors comm"
        value: "0"
      - 
        key: "Errors count #1"
        value: "0"
      - 
        key: "Errors count #2"
        value: "0"
      - 
        key: "Errors count #3"
        value: "0"
      - 
        key: "Errors count #4"
        value: "0"
  - 
    level: 0
    name: "mavros: Battery"
    message: "Normal"
    hardware_id: "udp://127.0.0.1:14551@:14551"
    values: 
      - 
        key: "Voltage"
        value: "12.59"
      - 
        key: "Current"
        value: "-28.1"
      - 
        key: "Remaining"
        value: "0.0"
  - 
    level: 0
    name: "mavros: Time Sync"
    message: "Normal"
    hardware_id: "udp://127.0.0.1:14551@:14551"
    values: 
      - 
        key: "Timesyncs since startup"
        value: "17505"
      - 
        key: "Frequency (Hz)"
        value: "9.999867"
      - 
        key: "Last RTT (ms)"
        value: "6.984635"
      - 
        key: "Mean RTT (ms)"
        value: "5.209176"
      - 
        key: "Last remote time (s)"
        value: "1787.161607000"
      - 
        key: "Estimated time offset (s)"
        value: "1713184098.605697632"
  - 
    level: 0
    name: "mavros: APM Memory"
    message: "Normal"
    hardware_id: "udp://127.0.0.1:14551@:14551"
    values: 
      - 
        key: "Free memory (B)"
        value: "131072"
      - 
        key: "Heap top"
        value: "0x0000"
  - 
    level: 2
    name: "mavros: APM Hardware"
    message: "Not initialised"
    hardware_id: "udp://127.0.0.1:14551@:14551"
    values: 
      - 
        key: "Core voltage"
        value: "-1.000000"
      - 
        key: "I2C errors"
        value: "0"
---

Check ID

rosrun mavros checkid