39#include "pprzlink/messages.h"
40#include "pprzlink/dl_protocol.h"
41#include "pprzlink/pprzlink_device.h"
42#include "pprzlink/pprz_transport.h"
46#warning "[hitl] Please define AP_DEV in your airframe file"
47#define AP_DEV "/dev/ttyUSB0"
50#define AP_BAUD B921600
54#define NPS_HITL_DEBUG 0
56#define DEBUG_PRINT printf
58#define DEBUG_PRINT(...) {}
67#define PPRZLINK_BUFFER_SIZE 256
119 unsigned char c =
'B';
140 printf(
"[hitl] lost connection. Exiting\n");
146 }
else if (
ret == -1) {
236 float airspeed = -1.f;
238 float sideslip = 0.f;
276 printf(
"SENSORS: task took longer than one period, exactly %f [ms], but the period is %f [ms]\n",
289 bool msg_available =
false;
324 printf(
"[hitl] receiving COMMANDS message\n");
343 printf(
"[hitl] receiving MOTOR_MIXING message\n");
352 msg_available =
false;
struct NpsAutopilot nps_autopilot
#ifndef NPS_NO_MOTOR_MIXING #include "modules/actuators/motor_mixing.h"
double commands[NPS_COMMANDS_NB]
#define NPS_COMMANDS_NB
Number of commands sent to the FDM of NPS.
uint8_t rx_buf[PPRZLINK_BUFFER_SIZE]
Receive buffer.
static void put_buffer(struct linkdev *d, long fd, const uint8_t *data, uint16_t len)
void * nps_sensors_loop(void *data)
uint8_t tx_buf[PPRZLINK_BUFFER_SIZE]
Transmit buffer.
static void send_message(struct linkdev *d, long fd)
#define PPRZLINK_BUFFER_SIZE
struct SerialPort * port
Serial port.
static struct linkdev dev
struct link_device device
Generic device interface.
void * nps_ap_data_loop(void *data)
static int char_available(struct linkdev *d)
void nps_hitl_impl_init(void)
END pprzlink_dev.
static uint8_t getch(struct linkdev *d)
static int check_free_space(struct linkdev *d, long *fd, uint16_t len)
struct pprz_transport pprz_tp
transport
static void put_byte(struct linkdev *d, long fd, uint8_t data)
#define clock_get_current_time(_x)
pthread_mutex_t fdm_mutex
bool nps_sensors_airspeed_available(void)
bool nps_sensors_gps_available(void)
bool nps_sensors_sideslip_available(void)
bool nps_sensors_aoa_available(void)
bool nps_sensors_baro_available(void)
bool nps_sensors_gyro_available(void)
void serial_port_free(struct SerialPort *me)
int serial_port_open_raw(struct SerialPort *me, const char *device, speed_t speed)
struct SerialPort * serial_port_new(void)
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.