vehicle_gps_position: add heading field

This commit is contained in:
Beat Küng
2018-07-16 09:54:19 +02:00
parent a8463a5226
commit 43c2970fb9
5 changed files with 11 additions and 0 deletions

View File

@@ -29,3 +29,5 @@ int32 timestamp_time_relative # timestamp + timestamp_time_relative = Time of th
uint64 time_utc_usec # Timestamp (microseconds, UTC), this is the timestamp which comes from the gps module. It might be unavailable right after cold start, indicated by a value of 0
uint8 satellites_used # Number of satellites used
float32 heading # heading in NED. Set to NaN if not set (used for dual antenna GPS), (rad, [-PI, PI])

View File

@@ -281,6 +281,8 @@ GPS::GPS(const char *path, gps_driver_mode_t mode, GPSHelper::Interface interfac
/* enforce null termination */
_port[sizeof(_port) - 1] = '\0';
_report_gps_pos.heading = NAN;
/* create satellite info data object if requested */
if (enable_sat_info) {
_sat_info = new GPS_Sat_Info();
@@ -650,6 +652,7 @@ GPS::run()
_report_gps_pos.cog_rad = 0.0f;
_report_gps_pos.vel_ned_valid = true;
_report_gps_pos.satellites_used = 10;
_report_gps_pos.heading = NAN;
/* no time and satellite information simulated */
@@ -700,6 +703,7 @@ GPS::run()
/* reset report */
memset(&_report_gps_pos, 0, sizeof(_report_gps_pos));
_report_gps_pos.heading = NAN;
if (_mode == GPS_DRIVER_MODE_UBX) {

View File

@@ -2139,6 +2139,8 @@ MavlinkReceiver::handle_message_hil_gps(mavlink_message_t *msg)
hil_gps.fix_type = gps.fix_type;
hil_gps.satellites_used = gps.satellites_visible; //TODO: rename mavlink_hil_gps_t sats visible to used?
hil_gps.heading = NAN;
if (_gps_pub == nullptr) {
_gps_pub = orb_advertise(ORB_ID(vehicle_gps_position), &hil_gps);

View File

@@ -178,6 +178,7 @@ GPSSIM::GPSSIM(const char *uart_path, bool fake_gps, bool enable_sat_info,
{
/* we need this potentially before it could be set in task_main */
g_dev = this;
_report_gps_pos.heading = NAN;
/* create satellite info data object if requested */
if (enable_sat_info) {

View File

@@ -379,6 +379,8 @@ void UavcanGnssBridge::process_fixx(const uavcan::ReceivedDataStructure<FixType>
report.hdop = msg.pdop;
report.vdop = msg.pdop;
report.heading = NAN;
// Publish to a multi-topic
int32_t gps_orb_instance;
orb_publish_auto(ORB_ID(vehicle_gps_position), &_report_pub, &report, &gps_orb_instance,