mavlink / mavros

MAVLink to ROS gateway with proxy for Ground Control Station
Other
875 stars 988 forks source link

Using fake gps, no output at /mavros/global_postion/global #1088

Closed Doodle1106 closed 5 years ago

Doodle1106 commented 5 years ago

Hi guys,

I am trying to use fake_gps plugin and I followed below steps:

  1. set MAV_USEHILGPS to 1
  2. Added fake_gps plugin to my px4_config.yaml.
  use_mocap: false         # ~mocap/pose
  mocap_transform: false   # ~mocap/tf instead of pose
  use_vision: true       # ~vision (pose)
  geo_origin:
    lat: 40.028907        # latitude [degrees]
    lon: 116.30301           # longitude [degrees]
    alt: 35.05            # altitude (height over the WGS-84 ellipsoid) [meters]
  eph: 2.0
  epv: 2.0
  satellites_visible: 5   # virtual number of visible satellites
  fix_type: 3             # type of GPS fix (default: 3D)
  tf:
    listen: false
    send: false           # send TF?
    frame_id: "map"       # TF frame_id
    child_frame_id: "fix" # TF child_frame_id
    rate_limit: 10.0      # TF rate
  gps_rate: 5.0           # GPS data publishing rate
  1. publish vision 3Dof pose to /mavros/fake_gps/vision
  2. I cannot set SYS_COMPANION to 257600 as I cannot find the parameter anywhere.

I tried to inspect the output of /mavros/global_position/global but nothing comes out. Am I doing it right? Do I have to set other parameters? I would really appreciate it if anyone can help me out.

Thanks

MAVROS version and platform

Mavros: ?0.18.4? ROS: ?Kinetic? Ubuntu: ?16.04?

Autopilot type and version

PX4

Version: ?3.7.1?

Node logs

PARAMETERS

NODES / mavros (mavros/mavros_node)

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

setting /run_id to b9e71ad0-c249-11e8-9156-9cb6d0e498fb process[rosout-1]: started with pid [7263] started core service [/rosout] process[mavros-2]: started with pid [7281] [ INFO] [1538048254.769173516]: FCU URL: udp://:14540@127.0.0.1:14557 [ INFO] [1538048254.770981450]: udp0: Bind address: 0.0.0.0:14540 [ INFO] [1538048254.771149091]: udp0: Remote address: 127.0.0.1:14557 [ INFO] [1538048254.771436506]: GCS bridge disabled [ INFO] [1538048254.771467482]: udp0: Remote address: 127.0.0.1:14557 [ INFO] [1538048254.781694980]: Plugin 3dr_radio loaded [ INFO] [1538048254.783643883]: Plugin 3dr_radio initialized [ INFO] [1538048254.783779728]: Plugin actuator_control loaded [ INFO] [1538048254.786801012]: Plugin actuator_control initialized [ INFO] [1538048254.789557615]: Plugin adsb loaded [ INFO] [1538048254.792915199]: Plugin adsb initialized [ INFO] [1538048254.793053316]: Plugin altitude loaded [ INFO] [1538048254.794045116]: Plugin altitude initialized [ INFO] [1538048254.794150398]: Plugin cam_imu_sync loaded [ INFO] [1538048254.794757668]: Plugin cam_imu_sync initialized [ INFO] [1538048254.794891312]: Plugin command loaded [ INFO] [1538048254.801782111]: Plugin command initialized [ INFO] [1538048254.801901633]: Plugin debug_value loaded [ INFO] [1538048254.806290840]: Plugin debug_value initialized [ INFO] [1538048254.806320793]: Plugin distance_sensor blacklisted [ INFO] [1538048254.806450368]: Plugin fake_gps loaded [ INFO] [1538048254.820377220]: Plugin fake_gps initialized [ INFO] [1538048254.820559614]: Plugin ftp loaded [ INFO] [1538048254.828403069]: Plugin ftp initialized [ INFO] [1538048254.828552887]: Plugin global_position loaded [ INFO] [1538048254.844711321]: Plugin global_position initialized [ INFO] [1538048254.844840742]: Plugin gps_rtk loaded [ INFO] [1538048254.847329597]: Plugin gps_rtk initialized [ INFO] [1538048254.847473203]: Plugin hil loaded [ INFO] [1538048254.862093045]: Plugin hil initialized [ INFO] [1538048254.862251493]: Plugin home_position loaded [ INFO] [1538048254.865947755]: Plugin home_position initialized [ INFO] [1538048254.866090139]: Plugin imu loaded [ INFO] [1538048254.874291734]: Plugin imu initialized [ INFO] [1538048254.874430291]: Plugin local_position loaded [ INFO] [1538048254.879899326]: Plugin local_position initialized [ INFO] [1538048254.880031364]: Plugin log_transfer loaded [ INFO] [1538048254.883095952]: Plugin log_transfer initialized [ INFO] [1538048254.883252314]: Plugin manual_control loaded [ INFO] [1538048254.886777005]: Plugin manual_control initialized [ INFO] [1538048254.886905137]: Plugin mocap_pose_estimate loaded [ INFO] [1538048254.890601317]: Plugin mocap_pose_estimate initialized [ INFO] [1538048254.890730737]: Plugin obstacle_distance loaded [ INFO] [1538048254.895091460]: Plugin obstacle_distance initialized [ INFO] [1538048254.895219040]: Plugin odom loaded [ INFO] [1538048254.899180381]: Plugin odom initialized [ INFO] [1538048254.899402095]: Plugin param loaded [ INFO] [1538048254.901945719]: Plugin param initialized [ INFO] [1538048254.902070498]: Plugin px4flow loaded [ INFO] [1538048254.909330714]: Plugin px4flow initialized [ INFO] [1538048254.909362248]: Plugin rangefinder blacklisted [ INFO] [1538048254.909528562]: Plugin rc_io loaded [ INFO] [1538048254.912984014]: Plugin rc_io initialized [ INFO] [1538048254.913014113]: Plugin safety_area blacklisted [ INFO] [1538048254.913145780]: Plugin setpoint_accel loaded [ INFO] [1538048254.916150706]: Plugin setpoint_accel initialized [ INFO] [1538048254.916392169]: Plugin setpoint_attitude loaded [ INFO] [1538048254.927020120]: Plugin setpoint_attitude initialized [ INFO] [1538048254.927175460]: Plugin setpoint_position loaded [ INFO] [1538048254.940853809]: Plugin setpoint_position initialized [ INFO] [1538048254.941006508]: Plugin setpoint_raw loaded [ INFO] [1538048254.949965114]: Plugin setpoint_raw initialized [ INFO] [1538048254.950111001]: Plugin setpoint_velocity loaded [ INFO] [1538048254.956473645]: Plugin setpoint_velocity initialized [ INFO] [1538048254.956752808]: Plugin sys_status loaded [ INFO] [1538048254.967263822]: Plugin sys_status initialized [ INFO] [1538048254.967472350]: Plugin sys_time loaded [ INFO] [1538048254.973645032]: TM: Timesync mode: MAVLINK [ INFO] [1538048254.975090345]: Plugin sys_time initialized [ INFO] [1538048254.975229339]: Plugin trajectory loaded [ INFO] [1538048254.980770266]: Plugin trajectory initialized [ INFO] [1538048254.980915150]: Plugin vfr_hud loaded [ INFO] [1538048254.981455007]: Plugin vfr_hud initialized [ INFO] [1538048254.981474114]: Plugin vibration blacklisted [ INFO] [1538048254.981580130]: Plugin vision_pose_estimate loaded [ INFO] [1538048254.989299353]: Plugin vision_pose_estimate initialized [ INFO] [1538048254.989428903]: Plugin vision_speed_estimate loaded [ INFO] [1538048254.993650347]: Plugin vision_speed_estimate initialized [ INFO] [1538048254.993831189]: Plugin waypoint loaded [ INFO] [1538048254.998359098]: Plugin waypoint initialized [ INFO] [1538048254.998514772]: Plugin wind_estimation loaded [ INFO] [1538048254.999306770]: Plugin wind_estimation initialized [ INFO] [1538048254.999343752]: Autostarting mavlink via USB on PX4 [ INFO] [1538048254.999437470]: Built-in SIMD instructions: SSE, SSE2 [ INFO] [1538048254.999452488]: Built-in MAVLink package version: 2018.8.8 [ INFO] [1538048254.999473436]: Known MAVLink dialects: common ardupilotmega ASLUAV autoquad icarous matrixpilot paparazzi slugs standard uAvionix ualberta [ INFO] [1538048254.999489878]: MAVROS started. MY ID 1.240, TARGET ID 1.1 [ INFO] [1538048255.006706004]: IMU: High resolution IMU detected! [ INFO] [1538048255.008314463]: IMU: Attitude quaternion IMU detected! [ INFO] [1538048255.543352215]: CON: Got HEARTBEAT, connected. FCU: PX4 Autopilot [ INFO] [1538048255.549623215]: IMU: High resolution IMU detected! [ INFO] [1538048255.551284165]: IMU: Attitude quaternion IMU detected! [ INFO] [1538048256.547602077]: VER: 1.1: Capabilities 0x000000000000e4ef [ INFO] [1538048256.547690215]: VER: 1.1: Flight software: 01080000 (00000000CE9C90E1) [ INFO] [1538048256.547754200]: VER: 1.1: Middleware software: 01080000 (00000000CE9C90E1) [ INFO] [1538048256.547840030]: VER: 1.1: OS software: 040f00ff (00000000F6F78190) [ INFO] [1538048256.547893797]: VER: 1.1: Board hardware: 00000001 [ INFO] [1538048256.547957728]: VER: 1.1: VID/PID: 0000:0000 [ INFO] [1538048256.548011098]: VER: 1.1: UID: 0000000100000002 [ WARN] [1538048256.548228556]: CMD: Unexpected command 520, result 0 [ INFO] [1538048270.545308198]: WP: mission received

Diagnostics

header: 
  seq: 354
  stamp: 
    secs: 1538048176
    nsecs: 428252367
  frame_id: ''
status: 
  - 
    level: 0
    name: "mavros: FCU connection"
    message: "connected"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values: 
      - 
        key: "Received packets:"
        value: "56799"
      - 
        key: "Dropped packets:"
        value: "0"
      - 
        key: "Buffer overruns:"
        value: "0"
      - 
        key: "Parse errors:"
        value: "0"
      - 
        key: "Rx sequence number:"
        value: "105"
      - 
        key: "Tx sequence number:"
        value: "171"
      - 
        key: "Rx total bytes:"
        value: "7694621"
      - 
        key: "Tx total bytes:"
        value: "256503"
      - 
        key: "Rx speed:"
        value: "17111.000000"
      - 
        key: "Tx speed:"
        value: "570.000000"
  - 
    level: 0
    name: "mavros: GPS"
    message: "3D fix"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values: 
      - 
        key: "Satellites visible"
        value: "10"
      - 
        key: "Fix type"
        value: "3"
      - 
        key: "EPH (m)"
        value: "0.00"
      - 
        key: "EPV (m)"
        value: "0.00"
  - 
    level: 0
    name: "mavros: Heartbeat"
    message: "Normal"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values: 
      - 
        key: "Heartbeats since startup"
        value: "449"
      - 
        key: "Frequency (Hz)"
        value: "0.999995"
      - 
        key: "Vehicle type"
        value: "Quadrotor"
      - 
        key: "Autopilot type"
        value: "PX4 Autopilot"
      - 
        key: "Mode"
        value: "AUTO.LOITER"
      - 
        key: "System status"
        value: "Standby"
  - 
    level: 0
    name: "mavros: System"
    message: "Normal"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values: 
      - 
        key: "Sensor present"
        value: "0x00000000"
      - 
        key: "Sensor enabled"
        value: "0x00000000"
      - 
        key: "Sensor helth"
        value: "0x00000000"
      - 
        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://:14540@127.0.0.1:14557"
    values: 
      - 
        key: "Voltage"
        value: "12.15"
      - 
        key: "Current"
        value: "-1.0"
      - 
        key: "Remaining"
        value: "100.0"
  - 
    level: 0
    name: "mavros: Time Sync"
    message: "Normal"
    hardware_id: "udp://:14540@127.0.0.1:14557"
    values: 
      - 
        key: "Timesyncs since startup"
        value: "4505"
      - 
        key: "Frequency (Hz)"
        value: "9.999918"
      - 
        key: "Last RTT (ms)"
        value: "0.328341"
      - 
        key: "Mean RTT (ms)"
        value: "0.305927"
      - 
        key: "Last remote time (s)"
        value: "455.480443000"
      - 
        key: "Estimated time offset (s)"
        value: "1538047720.923194647"
---

Check ID

OK. I got messages from 1:1.


Received 6213 messages, from 1 addresses sys:comp list of messages 1:1 0, 1, 2, 4, 140, 141, 147, 24, 26, 30, 31, 32, 33, 74, 76, 87, 230, 105, 111, 241, 242, 245

TSC21 commented 5 years ago

Ẁhat config did you set for fake_gps in px4_config.yaml?

Doodle1106 commented 5 years ago

@TSC21

Thanks for your replay, I've updated my description.

Cheers HR

TSC21 commented 5 years ago

what's the output of rostopic echo /mavros/fake_gps/vision?

Doodle1106 commented 5 years ago

@TSC21

I got reponse from /mavros/global_postion/global after several restarts but the lat and long value are still Zurich default value rather than my modified lat and long.

The output of /mavros/fake_gps/vision has the exact same value as what I published to it; while the output of /mavros/global_postion/global is :

header: 
  seq: 303
  stamp: 
    secs: 1538300528
    nsecs: 145340672
  frame_id: "base_link"
status: 
  status: 0
  service: 1
latitude: 47.3977608
longitude: 8.5456112
altitude: 545.260900428
position_covariance: [4.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 4.0]
position_covariance_type: 2

although I set what follows in px4_config.yaml

  use_mocap: false         # ~mocap/pose
  mocap_transform: false   # ~mocap/tf instead of pose
  use_vision: true       # ~vision (pose)
  geo_origin:
    lat: 40.028907        # latitude [degrees]
    lon: 116.30301           # longitude [degrees]
    alt: 35.05            # altitude (height over the WGS-84 ellipsoid) [meters]
  eph: 2.0
  epv: 2.0

the output of /mavros/global_position/local and /mavros/local_position/pose are similar and are roughly zero:

  seq: 24455
  stamp: 
    secs: 1538301993
    nsecs: 959581248
  frame_id: "map"
child_frame_id: "base_link"
pose: 
  pose: 
    position: 
      x: 0.0528472390014
      y: 0.0111187947004
      z: 0.081
    orientation: 
      x: 0.0214311271929
      y: -0.00541117329422
      z: -0.515657798546
      w: -0.856509477697
  covariance: [4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 99999.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 99999.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 99999.0]

the output of /mavros/fake_gps/vision is some arbitary constant value I set:

header: 
  seq: 0
  stamp: 1538302172.676561887
  frame_id: 
pose: 
  position: 
    x: 10
    y: 21
    z: 12.5
  orientation: 
    x: 0
    y: 0
    z: 0
    w: 0

I am testing above functions in the gazebo simulator but I dont think it has anything to do with the result.

Thanks again for your help. HR

TSC21 commented 5 years ago

You are using SITL right? Probably you are not aware, but Gazebo publishes GPS data to the flight controller in SITL mode.

Doodle1106 commented 5 years ago

thanks, closing the issue.

Coderx7 commented 2 years ago

hi @TSC21 is there a way to somehow get this to work in SITL? I have been trying for couple of days now, but no matter what I do, I cant get this to work?