Browse Source

vehicle_gps_position: add heading field

sbg
Beat Küng 7 years ago
parent
commit
43c2970fb9
  1. 2
      msg/vehicle_gps_position.msg
  2. 4
      src/drivers/gps/gps.cpp
  3. 2
      src/modules/mavlink/mavlink_receiver.cpp
  4. 1
      src/modules/simulator/gpssim/gpssim.cpp
  5. 2
      src/modules/uavcan/sensors/gnss.cpp

2
msg/vehicle_gps_position.msg

@ -29,3 +29,5 @@ int32 timestamp_time_relative # timestamp + timestamp_time_relative = Time of th @@ -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])

4
src/drivers/gps/gps.cpp

@ -281,6 +281,8 @@ GPS::GPS(const char *path, gps_driver_mode_t mode, GPSHelper::Interface interfac @@ -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() @@ -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() @@ -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) {

2
src/modules/mavlink/mavlink_receiver.cpp

@ -2139,6 +2139,8 @@ MavlinkReceiver::handle_message_hil_gps(mavlink_message_t *msg) @@ -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);

1
src/modules/simulator/gpssim/gpssim.cpp

@ -178,6 +178,7 @@ GPSSIM::GPSSIM(const char *uart_path, bool fake_gps, bool enable_sat_info, @@ -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) {

2
src/modules/uavcan/sensors/gnss.cpp

@ -379,6 +379,8 @@ void UavcanGnssBridge::process_fixx(const uavcan::ReceivedDataStructure<FixType> @@ -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,

Loading…
Cancel
Save