@MAWaayne, I have not direct experience with those messages, but in the library I can see that internal altitude info is replied in messageMAVLINK_MSG_ID_HIL_STATE with ID 90. Units are mm. You can find all the details in the file common\mavlink_msg_hil_state.h
. The most interesting part is the structure where message payload is stored:
#define MAVLINK_MSG_ID_HIL_STATE 90
typedef struct __mavlink_hil_state_t
{
uint64_t time_usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
float roll; ///< Roll angle (rad)
float pitch; ///< Pitch angle (rad)
float yaw; ///< Yaw angle (rad)
float rollspeed; ///< Roll angular speed (rad/s)
float pitchspeed; ///< Pitch angular speed (rad/s)
float yawspeed; ///< Yaw angular speed (rad/s)
int32_t lat; ///< Latitude, expressed as * 1E7
int32_t lon; ///< Longitude, expressed as * 1E7
int32_t alt; ///< Altitude in meters, expressed as * 1000 (millimeters)
int16_t vx; ///< Ground X Speed (Latitude), expressed as m/s * 100
int16_t vy; ///< Ground Y Speed (Longitude), expressed as m/s * 100
int16_t vz; ///< Ground Z Speed (Altitude), expressed as m/s * 100
int16_t xacc; ///< X acceleration (mg)
int16_t yacc; ///< Y acceleration (mg)
int16_t zacc; ///< Z acceleration (mg)
} mavlink_hil_state_t;
For GPS altitude I think you can use MAVLINK_MSG_ID_GPS_RAW_INT with ID 24. Units are also mm. You can find all the details in the file common\mavlink_msg_gps_raw_int.h
. The structure for the message payload in this case is:
#define MAVLINK_MSG_ID_GPS_RAW_INT 24
typedef struct __mavlink_gps_raw_int_t
{
uint64_t time_usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
int32_t lat; ///< Latitude in 1E7 degrees
int32_t lon; ///< Longitude in 1E7 degrees
int32_t alt; ///< Altitude in 1E3 meters (millimeters) above MSL
uint16_t eph; ///< GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535
uint16_t epv; ///< GPS VDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535
uint16_t vel; ///< GPS ground speed (m/s * 100). If unknown, set to: 65535
uint16_t cog; ///< Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535
uint8_t fix_type; ///< 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
uint8_t satellites_visible; ///< Number of satellites visible. If unknown, set to 255
} mavlink_gps_raw_int_t;
You will probably also need info on GPS status to make sure you have proper signal lock, check the number of satellites, precission, etc. This info is in mavlink_msg_gps_status.h
. Message structure:
#define MAVLINK_MSG_ID_GPS_STATUS 25
typedef struct __mavlink_gps_status_t
{
uint8_t satellites_visible; ///< Number of satellites visible
uint8_t satellite_prn[20]; ///< Global satellite ID
uint8_t satellite_used[20]; ///< 0: Satellite not used, 1: used for localization
uint8_t satellite_elevation[20]; ///< Elevation (0: right on top of receiver, 90: on the horizon) of satellite
uint8_t satellite_azimuth[20]; ///< Direction of satellite, 0: 0 deg, 255: 360 deg.
uint8_t satellite_snr[20]; ///< Signal to noise ratio of satellite
} mavlink_gps_status_t;
Now you need to know what are the streams to trigger messages to be sent from the Pixhawk. As I told you, I have not direct experience on this. I would say that GPS messages are triggered with MAV_DATA_STREAM_RAW_SENSORS
for the GPS altitude message and MAV_DATA_STREAM_EXTENDED_STATUS
for GPS status message. Regarding internal altitude, I would try with MAV_DATA_STREAM_POSITION
and see if it works. I cannot help more here.
Now I can’t help much more, I have diassembled the quad to do some adjustments and I will not be able to test anything until I find some time to finish it.
If you find the right combination of streams and messages, please revert!