Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ins_xsens700.c File Reference

Parser for the Xsens protocol. More...

#include "ins_module.h"
#include "ins_xsens.h"
#include <inttypes.h>
#include "generated/airframe.h"
#include "mcu_periph/sys_time.h"
#include "subsystems/datalink/downlink.h"
#include "messages.h"
#include "subsystems/imu.h"
#include "xsens_protocol.h"
#include "mcu_periph/uart.h"
#include "estimator.h"
+ Include dependency graph for ins_xsens700.c:

Go to the source code of this file.

Macros

#define XsensInitCheksum()   { send_ck = 0; }
 
#define XsensUpdateChecksum(c)   { send_ck += c; }
 
#define XsensSend1(c)   { uint8_t i8=c; InsUartSend1(i8); XsensUpdateChecksum(i8); }
 
#define XsensSend1ByAddr(x)   { XsensSend1(*x); }
 
#define XsensSend2ByAddr(x)   { XsensSend1(*(x+1)); XsensSend1(*x); }
 
#define XsensSend4ByAddr(x)   { XsensSend1(*(x+3)); XsensSend1(*(x+2)); XsensSend1(*(x+1)); XsensSend1(*x); }
 
#define XsensHeader(msg_id, len)
 
#define XsensTrailer()   { uint8_t i8=0x100-send_ck; InsUartSend1(i8); }
 
#define XSENS_MAX_PAYLOAD   254
 Includes macros generated from xsens_MTi-G.xml. More...
 
#define UNINIT   0
 
#define GOT_START   1
 
#define GOT_BID   2
 
#define GOT_MID   3
 
#define GOT_LEN   4
 
#define GOT_DATA   5
 
#define GOT_CHECKSUM   6
 
#define DOWNLINK_DEVICE   DOWNLINK_AP_DEVICE
 

Functions

void ahrs_init (void)
 AHRS initialization. More...
 
void imu_init (void)
 
void imu_periodic (void)
 
void ins_init (void)
 INS initialization. More...
 
static void xsens_ask_message_rate (uint8_t c1, uint8_t c2, uint8_t freq)
 
void ins_periodic_task (void)
 
void handle_ins_msg (void)
 
void parse_ins_msg (void)
 
void parse_ins_buffer (uint8_t c)
 

Variables

INS_FORMAT ins_x
 
INS_FORMAT ins_y
 
INS_FORMAT ins_z
 
INS_FORMAT ins_vx
 
INS_FORMAT ins_vy
 
INS_FORMAT ins_vz
 
INS_FORMAT ins_phi
 
INS_FORMAT ins_theta
 
INS_FORMAT ins_psi
 
INS_FORMAT ins_p
 
INS_FORMAT ins_q
 
INS_FORMAT ins_r
 
INS_FORMAT ins_ax
 
INS_FORMAT ins_ay
 
INS_FORMAT ins_az
 
INS_FORMAT ins_mx
 
INS_FORMAT ins_my
 
INS_FORMAT ins_mz
 
float ins_pitch_neutral
 
float ins_roll_neutral
 
volatile uint8_t ins_msg_received
 
uint8_t xsens_msg_buf [XSENS_MAX_PAYLOAD]
 
uint8_t xsens_errorcode
 
uint32_t xsens_msg_statusword
 
uint16_t xsens_time_stamp
 
uint16_t xsens_output_mode
 
uint32_t xsens_output_settings
 
float xsens_declination = 0
 
float xsens_gps_arm_x = 0
 
float xsens_gps_arm_y = 0
 
float xsens_gps_arm_z = 0
 
int8_t xsens_hour
 
int8_t xsens_min
 
int8_t xsens_sec
 
int32_t xsens_nanosec
 
int16_t xsens_year
 
int8_t xsens_month
 
int8_t xsens_day
 
static uint8_t xsens_id
 
static uint8_t xsens_status
 
static uint8_t xsens_len
 
static uint8_t xsens_msg_idx
 
static uint8_t ck
 
uint8_t send_ck
 
struct LlaCoor_f lla_f
 
struct UtmCoor_f utm_f
 
volatile int xsens_configured = 0
 

Detailed Description

Parser for the Xsens protocol.

Definition in file ins_xsens700.c.

Macro Definition Documentation

#define DOWNLINK_DEVICE   DOWNLINK_AP_DEVICE

Definition at line 140 of file ins_xsens700.c.

#define GOT_BID   2

Definition at line 132 of file ins_xsens700.c.

Referenced by parse_ins_buffer().

#define GOT_CHECKSUM   6

Definition at line 136 of file ins_xsens700.c.

#define GOT_DATA   5

Definition at line 135 of file ins_xsens700.c.

Referenced by parse_ins_buffer().

#define GOT_LEN   4

Definition at line 134 of file ins_xsens700.c.

Referenced by parse_ins_buffer().

#define GOT_MID   3

Definition at line 133 of file ins_xsens700.c.

Referenced by parse_ins_buffer().

#define GOT_START   1

Definition at line 131 of file ins_xsens700.c.

Referenced by parse_ins_buffer().

#define UNINIT   0

Definition at line 130 of file ins_xsens700.c.

Referenced by ins_init(), and parse_ins_buffer().

#define XSENS_MAX_PAYLOAD   254

Includes macros generated from xsens_MTi-G.xml.

Definition at line 126 of file ins_xsens700.c.

Referenced by parse_ins_buffer().

#define XsensHeader (   msg_id,
  len 
)
Value:
{ \
InsUartSend1(XSENS_START); \
XsensSend1(XSENS_BID); \
XsensSend1(msg_id); \
XsensSend1(len); \
}
#define XsensInitCheksum()
Definition: ins_xsens700.c:105
#define InsUartSend1(c)
Definition: ins_module.h:84
#define XsensSend1(c)
Definition: ins_xsens700.c:108

Definition at line 113 of file ins_xsens700.c.

Referenced by ins_periodic_task().

#define XsensInitCheksum ( )    { send_ck = 0; }

Definition at line 105 of file ins_xsens700.c.

#define XsensSend1 (   c)    { uint8_t i8=c; InsUartSend1(i8); XsensUpdateChecksum(i8); }

Definition at line 108 of file ins_xsens700.c.

#define XsensSend1ByAddr (   x)    { XsensSend1(*x); }

Definition at line 109 of file ins_xsens700.c.

Referenced by xsens_ask_message_rate().

#define XsensSend2ByAddr (   x)    { XsensSend1(*(x+1)); XsensSend1(*x); }

Definition at line 110 of file ins_xsens700.c.

#define XsensSend4ByAddr (   x)    { XsensSend1(*(x+3)); XsensSend1(*(x+2)); XsensSend1(*(x+1)); XsensSend1(*x); }

Definition at line 111 of file ins_xsens700.c.

#define XsensTrailer ( )    { uint8_t i8=0x100-send_ck; InsUartSend1(i8); }

Definition at line 120 of file ins_xsens700.c.

Referenced by ins_periodic_task().

#define XsensUpdateChecksum (   c)    { send_ck += c; }

Definition at line 106 of file ins_xsens700.c.

Function Documentation

void ahrs_init ( void  )

AHRS initialization.

Called at startup. Needs to be implemented by each AHRS algorithm.

Definition at line 76 of file ins_xsens700.c.

References ins_init().

+ Here is the call graph for this function:

void imu_init ( void  )

Definition at line 86 of file ins_xsens700.c.

Referenced by init_ap(), and main_init().

+ Here is the caller graph for this function:

void imu_periodic ( void  )

Definition at line 91 of file ins_xsens700.c.

References ins_periodic_task().

+ Here is the call graph for this function:

void ins_init ( void  )

INS initialization.

Called at startup. Needs to be implemented by each INS algorithm.

Definition at line 178 of file ins_xsens700.c.

Referenced by ahrs_init(), imu_init(), init_ap(), and main_init().

+ Here is the caller graph for this function:

void ins_periodic_task ( void  )

Definition at line 201 of file ins_xsens700.c.

References xsens_ask_message_rate(), xsens_configured, XsensHeader, and XsensTrailer.

Referenced by imu_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void xsens_ask_message_rate ( uint8_t  c1,
uint8_t  c2,
uint8_t  freq 
)
static

Definition at line 192 of file ins_xsens700.c.

References foo, and XsensSend1ByAddr.

Referenced by ins_periodic_task().

+ Here is the caller graph for this function:

Variable Documentation

uint8_t ck
static

Definition at line 170 of file ins_xsens700.c.

Referenced by parse_ins_buffer().

INS_FORMAT ins_ax

Definition at line 64 of file ins_xsens700.c.

Referenced by parse_ins_msg().

INS_FORMAT ins_ay

Definition at line 65 of file ins_xsens700.c.

Referenced by parse_ins_msg().

INS_FORMAT ins_az

Definition at line 66 of file ins_xsens700.c.

Referenced by parse_ins_msg().

volatile uint8_t ins_msg_received

Definition at line 103 of file ins_xsens700.c.

Referenced by parse_ins_buffer().

INS_FORMAT ins_mx

Definition at line 68 of file ins_xsens700.c.

INS_FORMAT ins_my

Definition at line 69 of file ins_xsens700.c.

INS_FORMAT ins_mz

Definition at line 70 of file ins_xsens700.c.

INS_FORMAT ins_p

Definition at line 60 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and parse_ins_msg().

INS_FORMAT ins_phi

Definition at line 56 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and parse_ins_msg().

float ins_pitch_neutral

Definition at line 72 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and ins_init().

INS_FORMAT ins_psi

Definition at line 58 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and parse_ins_msg().

INS_FORMAT ins_q

Definition at line 61 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and parse_ins_msg().

INS_FORMAT ins_r

Definition at line 62 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and parse_ins_msg().

float ins_roll_neutral
Todo:
harmonize infrared neutrals with ins_neutrals or get rid of ins neutrals this ins only needed for sim right now

Definition at line 73 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and ins_init().

INS_FORMAT ins_theta

Definition at line 57 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and parse_ins_msg().

INS_FORMAT ins_vx

Definition at line 52 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and parse_ins_msg().

INS_FORMAT ins_vy

Definition at line 53 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and parse_ins_msg().

INS_FORMAT ins_vz

Definition at line 54 of file ins_xsens700.c.

Referenced by handle_ins_msg(), and parse_ins_msg().

INS_FORMAT ins_x

Definition at line 48 of file ins_xsens700.c.

INS_FORMAT ins_y

Definition at line 49 of file ins_xsens700.c.

INS_FORMAT ins_z

Definition at line 50 of file ins_xsens700.c.

struct LlaCoor_f lla_f

Definition at line 173 of file ins_xsens700.c.

Referenced by parse_ins_msg().

uint8_t send_ck

Definition at line 171 of file ins_xsens700.c.

struct UtmCoor_f utm_f

Definition at line 174 of file ins_xsens700.c.

Referenced by parse_ins_msg().

volatile int xsens_configured = 0

Definition at line 176 of file ins_xsens700.c.

Referenced by ins_init(), and ins_periodic_task().

int8_t xsens_day

Definition at line 164 of file ins_xsens700.c.

float xsens_declination = 0

Definition at line 152 of file ins_xsens700.c.

Referenced by parse_ins_msg().

uint8_t xsens_errorcode

Definition at line 147 of file ins_xsens700.c.

Referenced by parse_ins_msg().

float xsens_gps_arm_x = 0

Definition at line 153 of file ins_xsens700.c.

Referenced by parse_ins_msg().

float xsens_gps_arm_y = 0

Definition at line 154 of file ins_xsens700.c.

Referenced by parse_ins_msg().

float xsens_gps_arm_z = 0

Definition at line 155 of file ins_xsens700.c.

Referenced by parse_ins_msg().

int8_t xsens_hour

Definition at line 158 of file ins_xsens700.c.

uint8_t xsens_id
static

Definition at line 166 of file ins_xsens700.c.

Referenced by parse_ins_buffer(), and parse_ins_msg().

uint8_t xsens_len
static

Definition at line 168 of file ins_xsens700.c.

Referenced by parse_ins_buffer(), and parse_ins_msg().

int8_t xsens_min

Definition at line 159 of file ins_xsens700.c.

int8_t xsens_month

Definition at line 163 of file ins_xsens700.c.

uint8_t xsens_msg_buf[XSENS_MAX_PAYLOAD]

Definition at line 127 of file ins_xsens700.c.

Referenced by parse_ins_buffer(), and parse_ins_msg().

uint8_t xsens_msg_idx
static

Definition at line 169 of file ins_xsens700.c.

Referenced by parse_ins_buffer().

uint32_t xsens_msg_statusword

Definition at line 148 of file ins_xsens700.c.

Referenced by ins_init(), and parse_ins_msg().

int32_t xsens_nanosec

Definition at line 161 of file ins_xsens700.c.

uint16_t xsens_output_mode

Definition at line 150 of file ins_xsens700.c.

uint32_t xsens_output_settings

Definition at line 151 of file ins_xsens700.c.

int8_t xsens_sec

Definition at line 160 of file ins_xsens700.c.

uint8_t xsens_status
static

Definition at line 167 of file ins_xsens700.c.

Referenced by ins_init(), and parse_ins_buffer().

uint16_t xsens_time_stamp

Definition at line 149 of file ins_xsens700.c.

Referenced by ins_init().

int16_t xsens_year

Definition at line 162 of file ins_xsens700.c.