@ -79,7 +79,7 @@ AP_GPS_UBLOX::AP_GPS_UBLOX(AP_GPS &_gps, AP_GPS::GPS_State &_state, AP_HAL::UART
@@ -79,7 +79,7 @@ AP_GPS_UBLOX::AP_GPS_UBLOX(AP_GPS &_gps, AP_GPS::GPS_State &_state, AP_HAL::UART
_unconfigured_messages | = CONFIG_TP5 ;
# endif
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
if ( role = = AP_GPS : : GPS_ROLE_MB_BASE & & ! mb_use_uart2 ( ) ) {
rtcm3_parser = new RTCM3_Parser ;
if ( rtcm3_parser = = nullptr ) {
@ -96,14 +96,14 @@ AP_GPS_UBLOX::AP_GPS_UBLOX(AP_GPS &_gps, AP_GPS::GPS_State &_state, AP_HAL::UART
@@ -96,14 +96,14 @@ AP_GPS_UBLOX::AP_GPS_UBLOX(AP_GPS &_gps, AP_GPS::GPS_State &_state, AP_HAL::UART
AP_GPS_UBLOX : : ~ AP_GPS_UBLOX ( )
{
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
if ( rtcm3_parser ) {
delete rtcm3_parser ;
}
# endif
}
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
/*
config for F9 GPS in moving baseline base role
See ZED - F9P integration manual section 3.1 .5 .6 .1
@ -205,7 +205,7 @@ const AP_GPS_UBLOX::config_list AP_GPS_UBLOX::config_MB_Rover_uart2[] {
@@ -205,7 +205,7 @@ const AP_GPS_UBLOX::config_list AP_GPS_UBLOX::config_MB_Rover_uart2[] {
{ ConfigKey : : MSGOUT_RTCM_3X_TYPE1127_UART1 , 0 } ,
{ ConfigKey : : MSGOUT_RTCM_3X_TYPE1230_UART1 , 0 } ,
} ;
# endif // GPS_UBLOX_ MOVING_BASELINE
# endif // GPS_MOVING_BASELINE
void
@ -357,7 +357,7 @@ AP_GPS_UBLOX::_request_next_config(void)
@@ -357,7 +357,7 @@ AP_GPS_UBLOX::_request_next_config(void)
}
break ;
case STEP_RTK_MOVBASE :
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
if ( supports_F9_config ( ) ) {
static_assert ( sizeof ( active_config . done_mask ) * 8 > = ARRAY_SIZE ( config_MB_Base_uart1 ) , " done_mask too small, base1 " ) ;
static_assert ( sizeof ( active_config . done_mask ) * 8 > = ARRAY_SIZE ( config_MB_Base_uart2 ) , " done_mask too small, base2 " ) ;
@ -572,7 +572,7 @@ AP_GPS_UBLOX::read(void)
@@ -572,7 +572,7 @@ AP_GPS_UBLOX::read(void)
// read the next byte
data = port - > read ( ) ;
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
if ( rtcm3_parser ) {
if ( rtcm3_parser - > read ( data ) ) {
// we've found a RTCMv3 packet. We stop parsing at
@ -682,7 +682,7 @@ AP_GPS_UBLOX::read(void)
@@ -682,7 +682,7 @@ AP_GPS_UBLOX::read(void)
break ; // bad checksum
}
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
if ( rtcm3_parser ) {
// this is a uBlox packet, discard any partial RTCMv3 state
rtcm3_parser - > reset ( ) ;
@ -856,7 +856,7 @@ uint8_t AP_GPS_UBLOX::config_key_size(ConfigKey key) const
@@ -856,7 +856,7 @@ uint8_t AP_GPS_UBLOX::config_key_size(ConfigKey key) const
*/
int8_t AP_GPS_UBLOX : : find_active_config_index ( ConfigKey key ) const
{
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
if ( active_config . list = = nullptr ) {
return - 1 ;
}
@ -1122,7 +1122,7 @@ AP_GPS_UBLOX::_parse_gps(void)
@@ -1122,7 +1122,7 @@ AP_GPS_UBLOX::_parse_gps(void)
default :
break ;
}
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
// see if it is in active config list
int8_t cfg_idx = find_active_config_index ( id ) ;
if ( cfg_idx > = 0 ) {
@ -1141,7 +1141,7 @@ AP_GPS_UBLOX::_parse_gps(void)
@@ -1141,7 +1141,7 @@ AP_GPS_UBLOX::_parse_gps(void)
}
}
}
# endif // GPS_UBLOX_ MOVING_BASELINE
# endif // GPS_MOVING_BASELINE
// step over the value
uint8_t step_size = config_key_size ( id ) ;
@ -1326,10 +1326,10 @@ AP_GPS_UBLOX::_parse_gps(void)
@@ -1326,10 +1326,10 @@ AP_GPS_UBLOX::_parse_gps(void)
state . hdop = 130 ;
# endif
break ;
# if GPS_MOVING_BASELINE
case MSG_RELPOSNED :
{
const Vector3f & offset0 = gps . _antenna_offset [ state . instance ^ 1 ] . get ( ) ;
const Vector3f & offset1 = gps . _antenna_offset [ state . instance ] . get ( ) ;
// note that we require the yaw to come from a fixed solution, not a float solution
// yaw from a float solution would only be acceptable with a very large separation between
// GPS modules
@ -1342,21 +1342,6 @@ AP_GPS_UBLOX::_parse_gps(void)
@@ -1342,21 +1342,6 @@ AP_GPS_UBLOX::_parse_gps(void)
static_cast < uint32_t > ( RELPOSNED : : refObsMiss ) |
static_cast < uint32_t > ( RELPOSNED : : carrSolnFloat ) ;
const Vector3f antenna_offset = offset0 - offset1 ;
const float offset_dist = antenna_offset . length ( ) ;
const float rel_dist = _buffer . relposned . relPosLength * 0.01 ;
const float dist_error = offset_dist - rel_dist ;
const float strict_length_error_allowed = 0.2 ; // allow for up to 20% error
const float min_separation = 0.05 ;
bool tilt_ok = true ;
const float min_dist = MIN ( offset_dist , rel_dist ) ;
# ifndef HAL_BUILD_AP_PERIPH
// when ahrs is available use it to constrain vertical component
const Vector3f antenna_tilt = AP : : ahrs ( ) . get_rotation_body_to_ned ( ) * antenna_offset ;
const float alt_error = _buffer . relposned . relPosD * 0.01 + antenna_tilt . z ;
tilt_ok = fabsf ( alt_error ) < strict_length_error_allowed * min_dist ;
# endif
_check_new_itow ( _buffer . relposned . iTOW ) ;
if ( _buffer . relposned . iTOW ! = _last_relposned_itow + 200 ) {
// useful for looking at packet loss on links
@ -1365,35 +1350,20 @@ AP_GPS_UBLOX::_parse_gps(void)
@@ -1365,35 +1350,20 @@ AP_GPS_UBLOX::_parse_gps(void)
_last_relposned_itow = _buffer . relposned . iTOW ;
_last_relposned_ms = AP_HAL : : millis ( ) ;
/*
RELPOSNED messages gives the NED distance from base to
rover . It comes from the rover
*/
MB_Debug ( " RELPOSNED[%u]: od:%.2f rd:%.2f ae:%.2f flags:0x%04x t=%u " ,
state . instance + 1 ,
offset_dist , rel_dist , alt_error ,
unsigned ( _buffer . relposned . flags ) ,
unsigned ( _buffer . relposned . iTOW ) ) ;
if ( ( ( _buffer . relposned . flags & valid_mask ) = = valid_mask ) & &
( ( _buffer . relposned . flags & invalid_mask ) = = 0 ) & &
rel_dist > min_separation & &
offset_dist > min_separation & &
fabsf ( dist_error ) < strict_length_error_allowed * min_dist & &
tilt_ok ) {
float rotation_offset_rad ;
const Vector3f diff = offset1 - offset0 ;
rotation_offset_rad = Vector2f ( diff . x , diff . y ) . angle ( ) ;
state . gps_yaw = wrap_360 ( _buffer . relposned . relPosHeading * 1e-5 - degrees ( rotation_offset_rad ) ) ;
state . have_gps_yaw = true ;
calculate_moving_base_yaw ( _buffer . relposned . relPosHeading * 1e-5 ,
_buffer . relposned . relPosLength * 0.01 ,
_buffer . relposned . relPosD * 0.01 ) ) {
state . gps_yaw_accuracy = _buffer . relposned . accHeading * 1e-5 ;
state . have_gps_yaw_accuracy = true ;
} else {
state . have_gps_yaw = false ;
state . have_gps_yaw_accuracy = false ;
}
}
break ;
# endif // GPS_MOVING_BASELINE
case MSG_PVT :
Debug ( " MSG_PVT " ) ;
@ -1707,7 +1677,7 @@ AP_GPS_UBLOX::_configure_valget(ConfigKey key)
@@ -1707,7 +1677,7 @@ AP_GPS_UBLOX::_configure_valget(ConfigKey key)
bool
AP_GPS_UBLOX : : _configure_config_set ( const config_list * list , uint8_t count , uint32_t unconfig_bit )
{
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
active_config . list = list ;
active_config . count = count ;
active_config . done_mask = 0 ;
@ -1887,7 +1857,7 @@ bool AP_GPS_UBLOX::get_lag(float &lag_sec) const
@@ -1887,7 +1857,7 @@ bool AP_GPS_UBLOX::get_lag(float &lag_sec) const
// F9 lag not verified yet from flight log, but likely to be at least
// as good as M8
lag_sec = 0.12f ;
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
if ( role = = AP_GPS : : GPS_ROLE_MB_BASE | |
role = = AP_GPS : : GPS_ROLE_MB_ROVER ) {
// the moving baseline rover will lag about 40ms from the
@ -1924,7 +1894,7 @@ void AP_GPS_UBLOX::_check_new_itow(uint32_t itow)
@@ -1924,7 +1894,7 @@ void AP_GPS_UBLOX::_check_new_itow(uint32_t itow)
// support for retrieving RTCMv3 data from a moving baseline base
bool AP_GPS_UBLOX : : get_RTCMV3 ( const uint8_t * & bytes , uint16_t & len )
{
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
if ( rtcm3_parser ) {
len = rtcm3_parser - > get_len ( bytes ) ;
return len > 0 ;
@ -1936,7 +1906,7 @@ bool AP_GPS_UBLOX::get_RTCMV3(const uint8_t *&bytes, uint16_t &len)
@@ -1936,7 +1906,7 @@ bool AP_GPS_UBLOX::get_RTCMV3(const uint8_t *&bytes, uint16_t &len)
// clear previous RTCM3 packet
void AP_GPS_UBLOX : : clear_RTCMV3 ( void )
{
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
if ( rtcm3_parser ) {
rtcm3_parser - > clear_packet ( ) ;
}
@ -1952,7 +1922,7 @@ bool AP_GPS_UBLOX::is_healthy(void) const
@@ -1952,7 +1922,7 @@ bool AP_GPS_UBLOX::is_healthy(void) const
return true ;
}
# endif
# if GPS_UBLOX_ MOVING_BASELINE
# if GPS_MOVING_BASELINE
if ( ( role = = AP_GPS : : GPS_ROLE_MB_BASE | |
role = = AP_GPS : : GPS_ROLE_MB_ROVER ) & &
! supports_F9_config ( ) ) {