Cannot setpoint through mavros

Issue details

Hello, I want to use /mavros/setpoint_position/pose to control the pixhawk FCU for OFFBOARD control, but when I listen to /mavros/local_position/pose it is not right for Z coordinate and is higher than what I have set in /mavros/setpoint_position/pose(I put it on the groud). But the motor of UAV ran fast which means it will still fly higher. So I cannot fly and I am confused why the /mavros/local_position/pose is not right for z coordinate, is it a software or hardware problem? Could anyone help to solve the problem? Thanks in advance!

MAVROS version and platform

Mavros: 0.18.4
ROS: Kinetic
Ubuntu: 16.04

Autopilot type and version

[ ] ArduPilot
[ ] PX4

Version: 3.7.1

Node logs

logging to /home/ubuntu/.ros/log/d9f27100-40cd-11e9-97f9-00117f139124/roslaunch-ubuntu-desktop-1771.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu-desktop:39712/

SUMMARY
========

CLEAR PARAMETERS
 * /mavros/

PARAMETERS
 * /mavros/cmd/use_comp_id_system_control: False
 * /mavros/conn/heartbeat_rate: 1.0
 * /mavros/conn/system_time_rate: 1.0
 * /mavros/conn/timeout: 10.0
 * /mavros/conn/timesync_rate: 10.0
 * /mavros/distance_sensor/hrlv_ez4_pub/field_of_view: 0.0
 * /mavros/distance_sensor/hrlv_ez4_pub/frame_id: hrlv_ez4_sonar
 * /mavros/distance_sensor/hrlv_ez4_pub/id: 0
 * /mavros/distance_sensor/hrlv_ez4_pub/orientation: PITCH_270
 * /mavros/distance_sensor/hrlv_ez4_pub/send_tf: True
 * /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/x: 0.0
 * /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/y: 0.0
 * /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/z: -0.1
 * /mavros/distance_sensor/laser_1_sub/id: 3
 * /mavros/distance_sensor/laser_1_sub/orientation: PITCH_270
 * /mavros/distance_sensor/laser_1_sub/subscriber: True
 * /mavros/distance_sensor/lidarlite_pub/field_of_view: 0.0
 * /mavros/distance_sensor/lidarlite_pub/frame_id: lidarlite_laser
 * /mavros/distance_sensor/lidarlite_pub/id: 1
 * /mavros/distance_sensor/lidarlite_pub/orientation: PITCH_270
 * /mavros/distance_sensor/lidarlite_pub/send_tf: True
 * /mavros/distance_sensor/lidarlite_pub/sensor_position/x: 0.0
 * /mavros/distance_sensor/lidarlite_pub/sensor_position/y: 0.0
 * /mavros/distance_sensor/lidarlite_pub/sensor_position/z: -0.1
 * /mavros/distance_sensor/sonar_1_sub/id: 2
 * /mavros/distance_sensor/sonar_1_sub/orientation: PITCH_270
 * /mavros/distance_sensor/sonar_1_sub/subscriber: True
 * /mavros/fake_gps/eph: 2.0
 * /mavros/fake_gps/epv: 2.0
 * /mavros/fake_gps/fix_type: 3
 * /mavros/fake_gps/geo_origin/alt: 408.0
 * /mavros/fake_gps/geo_origin/lat: 47.3667
 * /mavros/fake_gps/geo_origin/lon: 8.55
 * /mavros/fake_gps/gps_rate: 5.0
 * /mavros/fake_gps/mocap_transform: True
 * /mavros/fake_gps/satellites_visible: 5
 * /mavros/fake_gps/tf/child_frame_id: fix
 * /mavros/fake_gps/tf/frame_id: map
 * /mavros/fake_gps/tf/listen: False
 * /mavros/fake_gps/tf/rate_limit: 10.0
 * /mavros/fake_gps/tf/send: False
 * /mavros/fake_gps/use_mocap: True
 * /mavros/fake_gps/use_vision: False
 * /mavros/fcu_protocol: v2.0
 * /mavros/fcu_url: /dev/ttyACM0:57600
 * /mavros/gcs_url: 
 * /mavros/global_position/child_frame_id: base_link
 * /mavros/global_position/frame_id: map
 * /mavros/global_position/gps_uere: 1.0
 * /mavros/global_position/rot_covariance: 99999.0
 * /mavros/global_position/tf/child_frame_id: base_link
 * /mavros/global_position/tf/frame_id: map
 * /mavros/global_position/tf/global_frame_id: earth
 * /mavros/global_position/tf/send: False
 * /mavros/global_position/use_relative_alt: True
 * /mavros/image/frame_id: px4flow
 * /mavros/imu/angular_velocity_stdev: 0.000349065850399
 * /mavros/imu/frame_id: base_link
 * /mavros/imu/linear_acceleration_stdev: 0.0003
 * /mavros/imu/magnetic_stdev: 0.0
 * /mavros/imu/orientation_stdev: 1.0
 * /mavros/local_position/frame_id: map
 * /mavros/local_position/tf/child_frame_id: base_link
 * /mavros/local_position/tf/frame_id: map
 * /mavros/local_position/tf/send: False
 * /mavros/local_position/tf/send_fcu: False
 * /mavros/mission/pull_after_gcs: True
 * /mavros/mocap/use_pose: True
 * /mavros/mocap/use_tf: False
 * /mavros/odometry/frame_tf/body_frame_orientation: frd
 * /mavros/odometry/frame_tf/local_frame: vision_ned
 * /mavros/plugin_blacklist: ['safety_area', '...
 * /mavros/plugin_whitelist: []
 * /mavros/px4flow/frame_id: px4flow
 * /mavros/px4flow/ranger_fov: 0.118682389136
 * /mavros/px4flow/ranger_max_range: 5.0
 * /mavros/px4flow/ranger_min_range: 0.3
 * /mavros/safety_area/p1/x: 1.0
 * /mavros/safety_area/p1/y: 1.0
 * /mavros/safety_area/p1/z: 1.0
 * /mavros/safety_area/p2/x: -1.0
 * /mavros/safety_area/p2/y: -1.0
 * /mavros/safety_area/p2/z: -1.0
 * /mavros/setpoint_accel/send_force: False
 * /mavros/setpoint_attitude/reverse_thrust: False
 * /mavros/setpoint_attitude/tf/child_frame_id: target_attitude
 * /mavros/setpoint_attitude/tf/frame_id: map
 * /mavros/setpoint_attitude/tf/listen: False
 * /mavros/setpoint_attitude/tf/rate_limit: 50.0
 * /mavros/setpoint_attitude/use_quaternion: False
 * /mavros/setpoint_position/mav_frame: LOCAL_NED
 * /mavros/setpoint_position/tf/child_frame_id: target_position
 * /mavros/setpoint_position/tf/frame_id: map
 * /mavros/setpoint_position/tf/listen: False
 * /mavros/setpoint_position/tf/rate_limit: 50.0
 * /mavros/setpoint_velocity/mav_frame: LOCAL_NED
 * /mavros/startup_px4_usb_quirk: True
 * /mavros/sys/disable_diag: False
 * /mavros/sys/min_voltage: 10.0
 * /mavros/target_component_id: 1
 * /mavros/target_system_id: 1
 * /mavros/tdr_radio/low_rssi: 40
 * /mavros/time/time_ref_source: fcu
 * /mavros/time/timesync_avg_alpha: 0.6
 * /mavros/time/timesync_mode: MAVLINK
 * /mavros/vibration/frame_id: base_link
 * /mavros/vision_pose/tf/child_frame_id: vision_estimate
 * /mavros/vision_pose/tf/frame_id: map
 * /mavros/vision_pose/tf/listen: False
 * /mavros/vision_pose/tf/rate_limit: 10.0
 * /mavros/vision_speed/listen_twist: True
 * /mavros/vision_speed/twist_cov: True
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES
  /
    mavros (mavros/mavros_node)

auto-starting new master
process[master]: started with pid [1783]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to d9f27100-40cd-11e9-97f9-00117f139124
process[rosout-1]: started with pid [1796]
started core service [/rosout]
process[mavros-2]: started with pid [1800]
[ INFO] [1551958853.467312096]: FCU URL: /dev/ttyACM0:57600
[ INFO] [1551958853.478658659]: serial0: device: /dev/ttyACM0 @ 57600 bps
[ INFO] [1551958853.482921888]: GCS bridge disabled
[ INFO] [1551958853.663411888]: Plugin 3dr_radio loaded
[ INFO] [1551958853.672870846]: Plugin 3dr_radio initialized
[ INFO] [1551958853.673591836]: Plugin actuator_control loaded
[ INFO] [1551958853.692953919]: Plugin actuator_control initialized
[ INFO] [1551958853.742549440]: Plugin adsb loaded
[ INFO] [1551958853.763650742]: Plugin adsb initialized
[ INFO] [1551958853.764578503]: Plugin altitude loaded
[ INFO] [1551958853.771238086]: Plugin altitude initialized
[ INFO] [1551958853.771995898]: Plugin cam_imu_sync loaded
[ INFO] [1551958853.776052513]: Plugin cam_imu_sync initialized
[ INFO] [1551958853.776953294]: Plugin command loaded
[ INFO] [1551958853.817353815]: Plugin command initialized
[ INFO] [1551958853.818357565]: Plugin debug_value loaded
[ INFO] [1551958853.850483711]: Plugin debug_value initialized
[ INFO] [1551958853.851116159]: Plugin distance_sensor blacklisted
[ INFO] [1551958853.852024544]: Plugin fake_gps loaded
[ INFO] [1551958853.948065846]: Plugin fake_gps initialized
[ INFO] [1551958853.949216628]: Plugin ftp loaded
[ INFO] [1551958853.992368190]: Plugin ftp initialized
[ INFO] [1551958853.993626419]: Plugin global_position loaded
[ INFO] [1551958854.094410117]: Plugin global_position initialized
[ INFO] [1551958854.095425586]: Plugin gps_rtk loaded
[ INFO] [1551958854.111391419]: Plugin gps_rtk initialized
[ INFO] [1551958854.112493867]: Plugin hil loaded
[ INFO] [1551958854.198014961]: Plugin hil initialized
[ INFO] [1551958854.199143919]: Plugin home_position loaded
[ INFO] [1551958854.222217305]: Plugin home_position initialized
[ INFO] [1551958854.223469648]: Plugin imu loaded
[ INFO] [1551958854.272274232]: Plugin imu initialized
[ INFO] [1551958854.273536992]: Plugin local_position loaded
[ INFO] [1551958854.307724284]: Plugin local_position initialized
[ INFO] [1551958854.308774336]: Plugin log_transfer loaded
[ INFO] [1551958854.326261523]: Plugin log_transfer initialized
[ INFO] [1551958854.327426784]: Plugin manual_control loaded
[ INFO] [1551958854.347084961]: Plugin manual_control initialized
[ INFO] [1551958854.348436784]: Plugin mocap_pose_estimate loaded
[ INFO] [1551958854.375044179]: Plugin mocap_pose_estimate initialized
[ INFO] [1551958854.376093294]: Plugin obstacle_distance loaded
[ INFO] [1551958854.392174700]: Plugin obstacle_distance initialized
[ INFO] [1551958854.393336315]: Plugin odom loaded
[ INFO] [1551958854.419723294]: Plugin odom initialized
[ INFO] [1551958854.420860950]: Plugin param loaded
[ INFO] [1551958854.435062461]: Plugin param initialized
[ INFO] [1551958854.436101367]: Plugin px4flow loaded
[ INFO] [1551958854.481753502]: Plugin px4flow initialized
[ INFO] [1551958854.482149856]: Plugin rangefinder blacklisted
[ INFO] [1551958854.483534961]: Plugin rc_io loaded
[ INFO] [1551958854.506371263]: Plugin rc_io initialized
[ INFO] [1551958854.506981523]: Plugin safety_area blacklisted
[ INFO] [1551958854.507960377]: Plugin setpoint_accel loaded
[ INFO] [1551958854.528646054]: Plugin setpoint_accel initialized
[ INFO] [1551958854.529733190]: Plugin setpoint_attitude loaded
[ INFO] [1551958854.591885950]: Plugin setpoint_attitude initialized
[ INFO] [1551958854.593216888]: Plugin setpoint_position loaded
[ INFO] [1551958854.686333919]: Plugin setpoint_position initialized
[ INFO] [1551958854.687462408]: Plugin setpoint_raw loaded
[ INFO] [1551958854.744333658]: Plugin setpoint_raw initialized
[ INFO] [1551958854.745484179]: Plugin setpoint_velocity loaded
[ INFO] [1551958854.783344023]: Plugin setpoint_velocity initialized
[ INFO] [1551958854.784539700]: Plugin sys_status loaded
[ INFO] [1551958854.840211575]: Plugin sys_status initialized
[ INFO] [1551958854.841376940]: Plugin sys_time loaded
[ INFO] [1551958854.880399336]: TM: Timesync mode: MAVLINK
[ INFO] [1551958854.888271835]: Plugin sys_time initialized
[ INFO] [1551958854.889258867]: Plugin trajectory loaded
[ INFO] [1551958854.925960377]: Plugin trajectory initialized
[ INFO] [1551958854.927007356]: Plugin vfr_hud loaded
[ INFO] [1551958854.930989335]: Plugin vfr_hud initialized
[ INFO] [1551958854.931585273]: Plugin vibration blacklisted
[ INFO] [1551958854.932308554]: Plugin vision_pose_estimate loaded
[ INFO] [1551958854.986493033]: Plugin vision_pose_estimate initialized
[ INFO] [1551958854.987390377]: Plugin vision_speed_estimate loaded
[ INFO] [1551958855.014617773]: Plugin vision_speed_estimate initialized
[ INFO] [1551958855.015862408]: Plugin waypoint loaded
[ INFO] [1551958855.042914596]: Plugin waypoint initialized
[ INFO] [1551958855.044215325]: Plugin wind_estimation loaded
[ INFO] [1551958855.048553815]: Plugin wind_estimation initialized
[ INFO] [1551958855.049537721]: Autostarting mavlink via USB on PX4
[ INFO] [1551958855.050178398]: Built-in SIMD instructions: None
[ INFO] [1551958855.050776731]: Built-in MAVLink package version: 2018.11.11
[ INFO] [1551958855.051318971]: Known MAVLink dialects: common ardupilotmega ASLUAV autoquad icarous matrixpilot paparazzi slugs standard uAvionix ualberta
[ INFO] [1551958855.051865221]: MAVROS started. MY ID 1.240, TARGET ID 1.1
[ INFO] [1551958855.052162096]: IMU: High resolution IMU detected!
[ INFO] [1551958855.056843242]: IMU: Attitude quaternion IMU detected!
[ INFO] [1551958855.066004283]: RC_CHANNELS message detected!
[ INFO] [1551958855.968156002]: CON: Got HEARTBEAT, connected. FCU: PX4 Autopilot
[ INFO] [1551958855.971899283]: RC_CHANNELS message detected!
[ INFO] [1551958855.972291054]: IMU: High resolution IMU detected!
[ INFO] [1551958855.975188866]: IMU: Attitude quaternion IMU detected!
[ INFO] [1551958856.980777303]: VER: 1.1: Capabilities         0x00000000000024ef
[ INFO] [1551958856.981151210]: VER: 1.1: Flight software:     01060500 (0000000076F3614B)
[ INFO] [1551958856.981413501]: VER: 1.1: Middleware software: 01060500 (0000000000000001)
[ INFO] [1551958856.982956001]: VER: 1.1: OS software:         000000c0 (0000000000000001)
[ INFO] [1551958856.983421001]: VER: 1.1: Board hardware:      00000011
[ INFO] [1551958856.983680376]: VER: 1.1: VID/PID:             26ac:0011
[ INFO] [1551958856.985075845]: VER: 1.1: UID:                 3134510b35313935
[ WARN] [1551958856.986094126]: CMD: Unexpected command 520, result 0
[ INFO] [1551958870.973296100]: WP: mission received
[ WARN] [1551959138.248977925]: CMD: Unexpected command 176, result 0
[ WARN] [1551959192.840622748]: CMD: Unexpected command 176, result 0

Diagnostics

---
header: 
  seq: 389
  stamp: 
    secs: 1551959365
    nsecs:  53989922
  frame_id: ''
status: 
  - 
    level: 0
    name: "mavros: FCU connection"
    message: "connected"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Received packets:"
        value: "57603"
      - 
        key: "Dropped packets:"
        value: "0"
      - 
        key: "Buffer overruns:"
        value: "0"
      - 
        key: "Parse errors:"
        value: "0"
      - 
        key: "Rx sequence number:"
        value: "98"
      - 
        key: "Tx sequence number:"
        value: "225"
      - 
        key: "Rx total bytes:"
        value: "8284363"
      - 
        key: "Tx total bytes:"
        value: "428587"
      - 
        key: "Rx speed:"
        value: "16319.000000"
      - 
        key: "Tx speed:"
        value: "1620.000000"
  - 
    level: 0
    name: "mavros: GPS"
    message: "3D fix"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Satellites visible"
        value: "15"
      - 
        key: "Fix type"
        value: "4"
      - 
        key: "EPH (m)"
        value: "0.75"
      - 
        key: "EPV (m)"
        value: "1.23"
  - 
    level: 0
    name: "mavros: Heartbeat"
    message: "Normal"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Heartbeats since startup"
        value: "510"
      - 
        key: "Frequency (Hz)"
        value: "1.037041"
      - 
        key: "Vehicle type"
        value: "Quadrotor"
      - 
        key: "Autopilot type"
        value: "PX4 Autopilot"
      - 
        key: "Mode"
        value: "OFFBOARD"
      - 
        key: "System status"
        value: "Active"
  - 
    level: 0
    name: "mavros: System"
    message: "Normal"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Sensor present"
        value: "0x00000000"
      - 
        key: "Sensor enabled"
        value: "0x00000000"
      - 
        key: "Sensor helth"
        value: "0x00000000"
      - 
        key: "CPU Load (%)"
        value: "61.6"
      - 
        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: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Voltage"
        value: "11.85"
      - 
        key: "Current"
        value: "0.9"
      - 
        key: "Remaining"
        value: "93.0"
  - 
    level: 0
    name: "mavros: Time Sync"
    message: "Normal"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Timesyncs since startup"
        value: "5100"
      - 
        key: "Frequency (Hz)"
        value: "10.000042"
      - 
        key: "Last RTT (ms)"
        value: "1.213281"
      - 
        key: "Mean RTT (ms)"
        value: "2.005768"
      - 
        key: "Last remote time (s)"
        value: "867.698143000"
      - 
        key: "Estimated time offset (s)"
        value: "1551958497.290736198"

Topic detials

/mavros/local_position/pose

header: 
  seq: 12031
  stamp: 
    secs: 1551959412
    nsecs: 856812736
  frame_id: "map"
pose: 
  position: 
    x: -1.11049902439
    y: 10.6594743729
    z: 1.85423445702
  orientation: 
    x: -0.00766160953881
    y: 0.00225207075206
    z: -0.527026363023
    w: -0.849811542678
---
header: 
  seq: 12032
  stamp: 
    secs: 1551959412
    nsecs: 892801216
  frame_id: "map"
pose: 
  position: 
    x: -1.11397218704
    y: 10.6684141159
    z: 1.85775589943
  orientation: 
    x: -0.0076314707555
    y: 0.00221123160831
    z: -0.527020062069
    w: -0.84981573629
---

/mavros/setpoint_position/pose

---
header: 
  seq: 4540
  stamp: 
    secs: 0
    nsecs:         0
  frame_id: ''
pose: 
  position: 
    x: 0.0
    y: 0.0
    z: 1.0
  orientation: 
    x: 0.0
    y: 0.0
    z: 0.0
    w: 0.0
---
header: 
  seq: 4541
  stamp: 
    secs: 0
    nsecs:         0
  frame_id: ''
pose: 
  position: 
    x: 0.0
    y: 0.0
    z: 1.0
  orientation: 
    x: 0.0
    y: 0.0
    z: 0.0
    w: 0.0

Have you test flew the vehicle in position mode? If the drone doesn’t hover mid throttle, your hover throttle might be too high

Thanks for your reply!
I know why the problem is, because I caliberated the UAV in this height and the origin is set at this point.
Sorry to bother, I want to ask anthoer question that if I want to publish and get global position through mavros, which topic should I sub and pub? And what is the refresh rate of global position in mavros?

@YCH188 You can refer to the topic lists on the mavros wiki

I have solved this problem, it is because my baud rate is too low. I changed it from default 57600 to 921600.