PX4 Firmware
PX4 Autopilot Software http://px4.io
GPSSIM Class Reference
Inheritance diagram for GPSSIM:
Collaboration diagram for GPSSIM:

Public Member Functions

 GPSSIM (bool fake_gps, bool enable_sat_info, int fix_type, int num_sat, int noise_multiplier)
 
 ~GPSSIM () override
 
int init () override
 
int devIOCTL (unsigned long cmd, unsigned long arg) override
 
void set (int fix_type, int num_sat, int noise_multiplier)
 
void print_info ()
 Diagnostics - print some basic information about the driver. More...
 

Protected Member Functions

void _measure () override
 

Private Member Functions

void config ()
 Try to configure the GPS, handle outgoing communication to the GPS. More...
 
void task_main ()
 Worker task: main GPS thread that configures the GPS and parses incoming data, always running. More...
 
int set_baudrate (unsigned baud)
 Set the baudrate of the UART to the GPS. More...
 
void cmd_reset ()
 Send a reset command to the GPS. More...
 
int receive (int timeout)
 

Static Private Member Functions

static int task_main_trampoline (int argc, char *argv[])
 Trampoline to the worker task. More...
 

Private Attributes

bool _task_should_exit
 flag to make the main worker task exit More...
 
volatile int _task
 worker task More...
 
GPS_Sat_Info_Sat_Info
 instance of GPS sat info data object More...
 
struct vehicle_gps_position_s _report_gps_pos
 uORB topic for gps position More...
 
orb_advert_t _report_gps_pos_pub
 uORB pub for gps position More...
 
struct satellite_info_s_p_report_sat_info
 pointer to uORB topic for satellite info More...
 
orb_advert_t _report_sat_info_pub
 uORB pub for satellite info More...
 
SyncObj _sync
 
int _fix_type
 
int _num_sat
 
int _noise_multiplier
 
std::default_random_engine _gen
 

Detailed Description

Definition at line 85 of file gpssim.cpp.

Constructor & Destructor Documentation

◆ GPSSIM()

GPSSIM::GPSSIM ( bool  fake_gps,
bool  enable_sat_info,
int  fix_type,
int  num_sat,
int  noise_multiplier 
)

Definition at line 165 of file gpssim.cpp.

References GPS_Sat_Info::_data, _fix_type, _noise_multiplier, _num_sat, _p_report_sat_info, _report_gps_pos, _report_gps_pos_pub, _report_sat_info_pub, _Sat_Info, gpssim::g_dev, vehicle_gps_position_s::heading, and vehicle_gps_position_s::heading_offset.

Referenced by gpssim::start().

Here is the caller graph for this function:

◆ ~GPSSIM()

GPSSIM::~GPSSIM ( )
override

Definition at line 191 of file gpssim.cpp.

References _Sat_Info, _task, _task_should_exit, and gpssim::g_dev.

Member Function Documentation

◆ _measure()

void GPSSIM::_measure ( void  )
inlineoverrideprotected

Definition at line 104 of file gpssim.cpp.

◆ cmd_reset()

void GPSSIM::cmd_reset ( )
private

Send a reset command to the GPS.

Definition at line 356 of file gpssim.cpp.

Referenced by devIOCTL().

Here is the caller graph for this function:

◆ config()

void GPSSIM::config ( )
private

Try to configure the GPS, handle outgoing communication to the GPS.

◆ devIOCTL()

int GPSSIM::devIOCTL ( unsigned long  cmd,
unsigned long  arg 
)
override

Definition at line 237 of file gpssim.cpp.

References _sync, cmd_reset(), OK, and SENSORIOCRESET.

Here is the call graph for this function:

◆ init()

int GPSSIM::init ( )
override

Definition at line 213 of file gpssim.cpp.

References _task, ToneAlarmInterface::init(), OK, and task_main_trampoline().

Referenced by gpssim::start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_info()

void GPSSIM::print_info ( void  )

Diagnostics - print some basic information about the driver.

Definition at line 361 of file gpssim.cpp.

References _p_report_sat_info, _report_gps_pos, vehicle_gps_position_s::jamming_indicator, vehicle_gps_position_s::noise_per_ms, and vehicle_gps_position_s::timestamp.

Referenced by gpssim::info().

Here is the caller graph for this function:

◆ receive()

int GPSSIM::receive ( int  timeout)
private

Definition at line 267 of file gpssim.cpp.

References _fix_type, _gen, _noise_multiplier, _num_sat, _report_gps_pos, vehicle_gps_position_s::alt, vehicle_gps_position_s::cog_rad, vehicle_gps_position_s::eph, vehicle_gps_position_s::epv, f(), vehicle_gps_position_s::fix_type, Simulator::getGPSSample(), Simulator::getInstance(), gps, hrt_absolute_time(), vehicle_gps_position_s::lat, vehicle_gps_position_s::lon, vehicle_gps_position_s::s_variance_m_s, vehicle_gps_position_s::satellites_used, vehicle_gps_position_s::timestamp, vehicle_gps_position_s::vel_d_m_s, vehicle_gps_position_s::vel_e_m_s, vehicle_gps_position_s::vel_m_s, and vehicle_gps_position_s::vel_n_m_s.

Referenced by task_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set()

void GPSSIM::set ( int  fix_type,
int  num_sat,
int  noise_multiplier 
)

Definition at line 379 of file gpssim.cpp.

References _fix_type, _noise_multiplier, and _num_sat.

Referenced by gpssim_main().

Here is the caller graph for this function:

◆ set_baudrate()

int GPSSIM::set_baudrate ( unsigned  baud)
private

Set the baudrate of the UART to the GPS.

◆ task_main()

void GPSSIM::task_main ( )
private

Worker task: main GPS thread that configures the GPS and parses incoming data, always running.

Definition at line 311 of file gpssim.cpp.

References _p_report_sat_info, _report_gps_pos, _report_gps_pos_pub, _report_sat_info_pub, _task, _task_should_exit, orb_advertise(), ORB_ID, orb_publish(), orb_unadvertise(), receive(), and TIMEOUT_100MS.

Referenced by task_main_trampoline().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_main_trampoline()

int GPSSIM::task_main_trampoline ( int  argc,
char *  argv[] 
)
staticprivate

Trampoline to the worker task.

Definition at line 260 of file gpssim.cpp.

References gpssim::g_dev, and task_main().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _fix_type

int GPSSIM::_fix_type
private

Definition at line 116 of file gpssim.cpp.

Referenced by GPSSIM(), receive(), and set().

◆ _gen

std::default_random_engine GPSSIM::_gen
private

Definition at line 120 of file gpssim.cpp.

Referenced by receive().

◆ _noise_multiplier

int GPSSIM::_noise_multiplier
private

Definition at line 118 of file gpssim.cpp.

Referenced by GPSSIM(), receive(), and set().

◆ _num_sat

int GPSSIM::_num_sat
private

Definition at line 117 of file gpssim.cpp.

Referenced by GPSSIM(), receive(), and set().

◆ _p_report_sat_info

struct satellite_info_s* GPSSIM::_p_report_sat_info
private

pointer to uORB topic for satellite info

Definition at line 113 of file gpssim.cpp.

Referenced by GPSSIM(), print_info(), and task_main().

◆ _report_gps_pos

struct vehicle_gps_position_s GPSSIM::_report_gps_pos
private

uORB topic for gps position

Definition at line 111 of file gpssim.cpp.

Referenced by GPSSIM(), print_info(), receive(), and task_main().

◆ _report_gps_pos_pub

orb_advert_t GPSSIM::_report_gps_pos_pub
private

uORB pub for gps position

Definition at line 112 of file gpssim.cpp.

Referenced by GPSSIM(), and task_main().

◆ _report_sat_info_pub

orb_advert_t GPSSIM::_report_sat_info_pub
private

uORB pub for satellite info

Definition at line 114 of file gpssim.cpp.

Referenced by GPSSIM(), and task_main().

◆ _Sat_Info

GPS_Sat_Info* GPSSIM::_Sat_Info
private

instance of GPS sat info data object

Definition at line 110 of file gpssim.cpp.

Referenced by GPSSIM(), and ~GPSSIM().

◆ _sync

SyncObj GPSSIM::_sync
private

Definition at line 115 of file gpssim.cpp.

Referenced by devIOCTL().

◆ _task

volatile int GPSSIM::_task
private

worker task

Definition at line 109 of file gpssim.cpp.

Referenced by init(), task_main(), and ~GPSSIM().

◆ _task_should_exit

bool GPSSIM::_task_should_exit
private

flag to make the main worker task exit

Definition at line 108 of file gpssim.cpp.

Referenced by task_main(), and ~GPSSIM().


The documentation for this class was generated from the following file: