Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
nps_flightgear.c File Reference
#include "nps_flightgear.h"
#include <sys/socket.h>
#include <sys/time.h>
#include <errno.h>
#include <time.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <pthread.h>
#include "std.h"
#include "flight_gear.h"
#include "nps_main.h"
#include "nps_fdm.h"
#include "nps_atmosphere.h"
+ Include dependency graph for nps_flightgear.c:

Go to the source code of this file.

Functions

voidnps_flightgear_receive (void *data)
 Receive Flight Gear environment messages.
 
static double htond (double x)
 
static float htonf (float x)
 
void nps_flightgear_init (const char *host, unsigned int port, unsigned int port_in, unsigned int time_offset)
 
void nps_flightgear_send_fdm (void)
 Send FlightGear FDM packet For visualization with moving surfaces (elevator, propeller etc).
 
void nps_flightgear_send (void)
 Send FlightGear GUI packet For visualization of airplane position and attitude only start fgfs with –native-gui=socket... option.
 

Variables

struct { 
 
int socket
 
struct sockaddr_in addr
 
int socket_in
 
unsigned int initial_time
 
unsigned int time_offset
 
flightgear 
 
pthread_t th_fg_rx
 

Function Documentation

◆ htond()

static double htond ( double  x)
static

Definition at line 33 of file nps_flightgear.c.

References foo, and p.

Referenced by nps_flightgear_send_fdm().

+ Here is the caller graph for this function:

◆ htonf()

static float htonf ( float  x)
static

Definition at line 44 of file nps_flightgear.c.

References foo, and p.

Referenced by nps_flightgear_send_fdm().

+ Here is the caller graph for this function:

◆ nps_flightgear_init()

void nps_flightgear_init ( const char host,
unsigned int  port,
unsigned int  port_in,
unsigned int  time_offset 
)

Definition at line 52 of file nps_flightgear.c.

References flightgear, foo, nps_flightgear_receive(), th_fg_rx, and time.

Referenced by nps_flight_gear_loop().

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

◆ nps_flightgear_receive()

void * nps_flightgear_receive ( void data)

Receive Flight Gear environment messages.

Definition at line 231 of file nps_flightgear.c.

References fdm_mutex, flightgear, foo, nps_atmosphere_set_wind_ned(), and TRUE.

Referenced by nps_flightgear_init().

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

◆ nps_flightgear_send()

void nps_flightgear_send ( void  )

Send FlightGear GUI packet For visualization of airplane position and attitude only start fgfs with –native-gui=socket... option.

This is the default option

Definition at line 179 of file nps_flightgear.c.

References LlaCoor_d::alt, fdm, FG_NET_GUI_VERSION, flightgear, foo, LlaCoor_d::lat, NpsFdm::lla_pos, LlaCoor_d::lon, NpsFdm::ltp_to_body_eulers, DoubleEulers::phi, DoubleEulers::psi, DoubleEulers::theta, NpsFdm::time, and FGNetGUI::version.

Referenced by nps_flight_gear_loop().

+ Here is the caller graph for this function:

◆ nps_flightgear_send_fdm()

void nps_flightgear_send_fdm ( void  )

Send FlightGear FDM packet For visualization with moving surfaces (elevator, propeller etc).

start fgfs with –native-fdm=socket... option

Definition at line 115 of file nps_flightgear.c.

References NpsFdm::agl, LlaCoor_d::alt, NpsFdm::elevator, NpsFdm::eng_state, fdm, FG_NET_FDM_MAX_ENGINES, FG_NET_FDM_VERSION, NpsFdm::flap, flightgear, foo, htond(), htonf(), LlaCoor_d::lat, NpsFdm::left_aileron, NpsFdm::lla_pos, LlaCoor_d::lon, NpsFdm::ltp_to_body_eulers, NpsFdm::num_engines, DoubleEulers::phi, DoubleEulers::psi, NpsFdm::right_aileron, NpsFdm::rpm, NpsFdm::rudder, DoubleEulers::theta, and NpsFdm::time.

Referenced by nps_flight_gear_loop().

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

Variable Documentation

◆ [struct]

◆ th_fg_rx

pthread_t th_fg_rx

Definition at line 29 of file nps_flightgear.c.

Referenced by nps_flightgear_init().