mavlink / mavros

MAVLink to ROS gateway with proxy for Ground Control Station
Other
879 stars 990 forks source link

Read calibration result with mavros #1885

Open PawelMiera opened 1 year ago

PawelMiera commented 1 year ago

Hello, I would like to perform calibration using mavros, that is installed on small onboard computer in my case NanoPi.

Issue details

Right now I can initialize for example level horizon calibration it using commandLong:

rospy.loginfo("Calibrating level horizon")
try:
    res = self.set_cmd_long_srv(command=241, param1=0, param2=0, param3=0, param4=0,
                                param5=2, param6=0, param7=0)
    if res.success:
        rospy.loginfo("Calibrating level horizon pending")
except rospy.ServiceException as e:
    rospy.logerr(str(e))

On PX4 I am getting calibtration messages on topic /mavros/statustext/recv, but only if I forward mavlink to gcs and connect with qGroundcontrol. Otherwise I am not getting anything on that topic.

Here is how i launch mavros with gcs forwarding:

roslaunch mavros px4.launch fcu_url:="/dev/ttyS1:115200" gcs_url:="udp://@192.168.0.102:14550"

On Ardupilot I am getting preflight messages on topic /mavros/statustext/recv but when I start calibration I am getting nothing.

Is there any way to start mavros so I will get the calibration results on any topic without connecting to gcs? Can I write some plugin to mavros that will publish FCU messages to some topic when new message appears?

MAVROS version and platform

Mavros: 1.15.0-1focal.20230216.003459 ROS: Noetic Ubuntu: 20.04

Autopilot type and version

[x]ArduPilot [x] PX4

Version: [v1.13.3]

Mavros output with gcs connected (they also appear on mavros topic /mavros/statustext/recv)

[ INFO] [1691665844.914292237]: WP: seems GCS requesting mission
[ INFO] [1691665844.914327222]: WP: scheduling pull after GCS is done
[ INFO] [1691665844.918264716]: GF: seems GCS requesting mission
[ INFO] [1691665844.918290770]: GF: scheduling pull after GCS is done
[ INFO] [1691665845.134416393]: RP: seems GCS requesting mission
[ INFO] [1691665845.134458250]: RP: scheduling pull after GCS is done
[ INFO] [1691665849.914649377]: WP: mission received
[ INFO] [1691665849.918576615]: GF: mission received
[ INFO] [1691665850.134799431]: RP: mission received
[ WARN] [1691665877.695881864]: CMD: Unexpected command 241, result 0
[ INFO] [1691665877.695958561]: FCU: [cal] calibration started: 2 level
[ INFO] [1691665877.747809896]: FCU: [cal] progress <0>
[ INFO] [1691665877.807860706]: FCU: [cal] progress <20>
[ INFO] [1691665877.907722838]: FCU: [cal] progress <40>
[ INFO] [1691665878.007762367]: FCU: [cal] progress <60>
[ INFO] [1691665878.107978772]: FCU: [cal] progress <80>
[ INFO] [1691665878.207816006]: FCU: [cal] progress <100>
[ INFO] [1691665878.259757869]: FCU: [cal] progress <100>
[ INFO] [1691665878.307764075]: FCU: [cal] calibration done: level

Diagnostics

header: 
  seq: 10
  stamp: 
    secs: 1691665367
    nsecs: 971932863
  frame_id: ''
status: 
  - 
    level: 0
    name: "mavros: FCU connection"
    message: "connected"
    hardware_id: "udp://:14540@"
    values: 
      - 
        key: "Received packets:"
        value: "2136"
      - 
        key: "Dropped packets:"
        value: "0"
      - 
        key: "Buffer overruns:"
        value: "0"
      - 
        key: "Parse errors:"
        value: "0"
      - 
        key: "Rx sequence number:"
        value: "116"
      - 
        key: "Tx sequence number:"
        value: "0"
      - 
        key: "Rx total bytes:"
        value: "126509"
      - 
        key: "Tx total bytes:"
        value: "2942"
      - 
        key: "Rx speed:"
        value: "36537.000000"
      - 
        key: "Tx speed:"
        value: "875.000000"
  - 
    level: 0
    name: "mavros: GPS"
    message: "3D fix"
    hardware_id: "udp://:14540@"
    values: 
      - 
        key: "Satellites visible"
        value: "10"
      - 
        key: "Fix type"
        value: "3"
      - 
        key: "EPH (m)"
        value: "0.00"
      - 
        key: "EPV (m)"
        value: "0.00"
  - 
    level: 1
    name: "mavros: Mount"
    message: "Can not diagnose in this targeting mode"
    hardware_id: "udp://:14540@"
    values: 
      - 
        key: "Mode"
        value: "255"
  - 
    level: 0
    name: "mavros: Heartbeat"
    message: "Normal"
    hardware_id: "udp://:14540@"
    values: 
      - 
        key: "Heartbeats since startup"
        value: "6"
      - 
        key: "Frequency (Hz)"
        value: "1.193780"
      - 
        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@"
    values: 
      - 
        key: "Sensor present"
        value: "0x9028802C"
      - 
        key: "Sensor enabled"
        value: "0x9028800C"
      - 
        key: "Sensor health"
        value: "0x902E802F"
      - 
        key: "3D magnetometer"
        value: "Ok"
      - 
        key: "absolute pressure"
        value: "Ok"
      - 
        key: "motor outputs / control"
        value: "Ok"
      - 
        key: "2nd 3D magnetometer"
        value: "Ok"
      - 
        key: "AHRS subsystem health"
        value: "Ok"
      - 
        key: "pre-arm check status. Always healthy when armed"
        value: "Ok"
      - 
        key: "CPU Load (%)"
        value: "8.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@"
    values: 
      - 
        key: "Voltage"
        value: "16.20"
      - 
        key: "Current"
        value: "1.0"
      - 
        key: "Remaining"
        value: "100.0"
  - 
    level: 0
    name: "mavros: Time Sync"
    message: "Normal"
    hardware_id: "udp://:14540@"
    values: 
      - 
        key: "Timesyncs since startup"
        value: "50"
      - 
        key: "Frequency (Hz)"
        value: "9.961861"
      - 
        key: "Last RTT (ms)"
        value: "0.062378"
      - 
        key: "Mean RTT (ms)"
        value: "0.138678"
      - 
        key: "Last remote time (s)"
        value: "608.336000000"
      - 
        key: "Estimated time offset (s)"
        value: "1691664759.621199608"

Check ID

OK. I got messages from 1:1.

---
Received 6160 messages, from 1 addresses
sys:comp   list of messages
  1:1     0, 1, 2, 4, 8, 140, 141, 147, 24, 411, 30, 31, 32, 33, 36, 74, 331, 83, 340, 85, 230, 105, 111, 241, 242, 245