Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ins_xsens700.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Christophe De Wagter
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22 
28 #include "ins_module.h"
29 #include "ins_xsens.h"
30 #include "subsystems/ins.h"
31 
32 #include <inttypes.h>
33 
34 #include "generated/airframe.h"
35 
36 #include "mcu_periph/sys_time.h"
38 #include "messages.h"
39 
40 #if USE_GPS_XSENS
41 #if !USE_GPS
42 #error "USE_GPS needs to be 1 to use the Xsens GPS!"
43 #endif
44 #include "subsystems/gps.h"
45 #include "subsystems/abi.h"
48 #include "subsystems/navigation/common_nav.h" /* needed for nav_utm_zone0 */
49 #endif
50 
51 // positions
55 
56 // velocities
60 
61 // body angles
65 
66 // angle rates
70 
71 // accelerations
75 
76 // magnetic
80 
81 #if USE_INS_MODULE
82 float ins_pitch_neutral;
83 float ins_roll_neutral;
84 #endif
85 
86 
88 //
89 // XSens Specific
90 //
91 
93 
94 #define XsensInitCheksum() { send_ck = 0; }
95 #define XsensUpdateChecksum(c) { send_ck += c; }
96 
97 #define XsensSend1(c) { uint8_t i8=c; InsUartSend1(i8); XsensUpdateChecksum(i8); }
98 #define XsensSend1ByAddr(x) { XsensSend1(*x); }
99 #define XsensSend2ByAddr(x) { XsensSend1(*(x+1)); XsensSend1(*x); }
100 #define XsensSend4ByAddr(x) { XsensSend1(*(x+3)); XsensSend1(*(x+2)); XsensSend1(*(x+1)); XsensSend1(*x); }
101 
102 #define XsensHeader(msg_id, len) { \
103  InsUartSend1(XSENS_START); \
104  XsensInitCheksum(); \
105  XsensSend1(XSENS_BID); \
106  XsensSend1(msg_id); \
107  XsensSend1(len); \
108  }
109 #define XsensTrailer() { uint8_t i8=0x100-send_ck; InsUartSend1(i8); }
110 
112 #include "xsens_protocol.h"
113 
114 
115 #define XSENS_MAX_PAYLOAD 254
117 
118 
119 #define UNINIT 0
120 #define GOT_START 1
121 #define GOT_BID 2
122 #define GOT_MID 3
123 #define GOT_LEN 4
124 #define GOT_DATA 5
125 #define GOT_CHECKSUM 6
126 
127 // FIXME Debugging Only
128 #include "mcu_periph/uart.h"
129 #include "messages.h"
131 
132 
139 float xsens_gps_arm_x = 0;
140 float xsens_gps_arm_y = 0;
141 float xsens_gps_arm_z = 0;
142 
143 
151 
156 static uint8_t ck;
158 
161 
162 volatile int xsens_configured = 0;
163 
164 void xsens_init(void);
165 
166 void xsens_init(void)
167 {
168 
170  xsens_configured = 30;
171 
173  xsens_time_stamp = 0;
174 
175 }
176 
177 #if USE_INS_MODULE
178 void ins_xsens_update_gps(struct GpsState *gps_s);
179 
180 void ins_xsens_init(void)
181 {
182  struct UtmCoor_f utm0 = { nav_utm_north0, nav_utm_east0, 0., nav_utm_zone0 };
184  stateSetPositionUtm_f(&utm0);
185 
188 
189  xsens_init();
190 }
191 
192 #include "subsystems/abi.h"
193 static abi_event gps_ev;
194 static void gps_cb(uint8_t sender_id __attribute__((unused)),
195  uint32_t stamp __attribute__((unused)),
196  struct GpsState *gps_s)
197 {
198  ins_xsens_update_gps(gps_s);
199 }
200 
201 void ins_xsens_register(void)
202 {
203  ins_register_impl(ins_xsens_init);
204  AbiBindMsgGPS(ABI_BROADCAST, &gps_ev, gps_cb);
205 }
206 
207 void ins_xsens_update_gps(struct GpsState *gps_s)
208 {
209  struct UtmCoor_f utm;
210  utm.east = gps_s->utm_pos.east / 100.;
211  utm.north = gps_s->utm_pos.north / 100.;
212  utm.zone = nav_utm_zone0;
213  utm.alt = gps_s->hmsl / 1000.;
214 
215  // set position
216  stateSetPositionUtm_f(&utm);
217 
218  struct NedCoor_f ned_vel = {
219  gps_s->ned_vel.x / 100.,
220  gps_s->ned_vel.y / 100.,
221  gps_s->ned_vel.z / 100.
222  };
223  // set velocity
224  stateSetSpeedNed_f(&ned_vel);
225 }
226 #endif
227 
228 #if USE_GPS_XSENS
229 void gps_impl_init(void)
230 {
231  gps.nb_channels = 0;
232 }
233 
234 static void gps_xsens_publish(void)
235 {
236  // publish gps data
237  uint32_t now_ts = get_sys_time_usec();
240  if (gps.fix == GPS_FIX_3D) {
243  }
244  AbiSendMsgGPS(GPS_XSENS_ID, now_ts, &gps);
245 }
246 #endif
247 
249 {
250  uint8_t foo = 0;
251  XsensSend1ByAddr(&c1);
252  XsensSend1ByAddr(&c2);
253  XsensSend1ByAddr(&foo);
254  XsensSend1ByAddr(&freq);
255 }
256 
257 void xsens_periodic(void)
258 {
259  if (xsens_configured > 0) {
260  switch (xsens_configured) {
261  case 25:
262  /* send mode and settings to MT */
263  XSENS_GoToConfig();
264  //XSENS_SetOutputMode(xsens_output_mode);
265  //XSENS_SetOutputSettings(xsens_output_settings);
266  break;
267  case 18:
268  // Give pulses on SyncOut
269  //XSENS_SetSyncOutSettings(0,0x0002);
270  break;
271  case 17:
272 
273  XsensHeader(XSENS_SetOutputConfiguration_ID, 44);
274  xsens_ask_message_rate(0x10, 0x10, 4); // UTC
275  xsens_ask_message_rate(0x20, 0x30, 100); // Attitude Euler
276  xsens_ask_message_rate(0x40, 0x10, 100); // Delta-V
277  xsens_ask_message_rate(0x80, 0x20, 100); // Rate of turn
278  xsens_ask_message_rate(0xE0, 0x20, 50); // Status
279  xsens_ask_message_rate(0x30, 0x10, 50); // Baro Pressure
280  xsens_ask_message_rate(0x88, 0x40, 1); // NavSol
281  xsens_ask_message_rate(0x88, 0xA0, 1); // SV Info
282  xsens_ask_message_rate(0x50, 0x20, 50); // GPS Altitude Ellipsiod
283  xsens_ask_message_rate(0x50, 0x40, 50); // GPS Position
284  xsens_ask_message_rate(0xD0, 0x10, 50); // GPS Speed
285  XsensTrailer();
286  break;
287  case 2:
288  //XSENS_ReqLeverArmGps();
289  break;
290 
291  case 6:
292  //XSENS_ReqMagneticDeclination();
293  break;
294 
295  case 13:
296  //#ifdef AHRS_H_X
297  //#pragma message "Sending XSens Magnetic Declination."
298  //xsens_declination = atan2(AHRS_H_Y, AHRS_H_X);
299  //XSENS_SetMagneticDeclination(xsens_declination);
300  //#endif
301  break;
302  case 12:
303 #ifdef GPS_IMU_LEVER_ARM_X
304 #pragma message "Sending XSens GPS Arm."
305  XSENS_SetLeverArmGps(GPS_IMU_LEVER_ARM_X, GPS_IMU_LEVER_ARM_Y, GPS_IMU_LEVER_ARM_Z);
306 #endif
307  break;
308  case 10: {
309  uint8_t baud = 1;
310  XSENS_SetBaudrate(baud);
311  }
312  break;
313 
314  case 1:
315  XSENS_GoToMeasurment();
316  break;
317  default:
318  break;
319  }
321  return;
322  }
323 
324  //RunOnceEvery(100,XSENS_ReqGPSStatus());
325 }
326 
327 #if USE_INS_MODULE
328 #include "state.h"
329 
330 static inline void update_state_interface(void)
331 {
332  // Send to Estimator (Control)
333 #if XSENS_BACKWARDS
334  struct FloatEulers att = {
337  -ins_psi + RadOfDeg(180)
338  };
339  struct FloatRates rates = {
340  ins_p,
341  -ins_q,
342  -ins_r
343  };
344 #else
345  struct FloatEulers att = {
348  -ins_psi
349  };
350  struct FloatRates rates = {
351  -ins_p,
352  ins_q,
353  -ins_r
354  };
355 #endif
357  stateSetBodyRates_f(&rates);
358 }
359 #endif /* USE_INS_MODULE */
360 
361 void handle_ins_msg(void)
362 {
363 
364 #if USE_INS_MODULE
365  update_state_interface();
366 #endif
367 
368 #if USE_GPS_XSENS
369  // Horizontal speed
370  float fspeed = sqrt(ins_vx * ins_vx + ins_vy * ins_vy);
371  if (gps.fix != GPS_FIX_3D) {
372  fspeed = 0;
373  }
374  gps.gspeed = fspeed * 100.;
375  gps.speed_3d = (uint16_t)(sqrt(ins_vx * ins_vx + ins_vy * ins_vy + ins_vz * ins_vz) * 100);
376 
377  float fcourse = atan2f((float)ins_vy, (float)ins_vx);
378  gps.course = fcourse * 1e7;
379 #endif // USE_GPS_XSENS
380 }
381 
382 void parse_ins_msg(void)
383 {
384  uint8_t offset = 0;
385  if (xsens_id == XSENS_ReqLeverArmGpsAck_ID) {
386  xsens_gps_arm_x = XSENS_ReqLeverArmGpsAck_x(xsens_msg_buf);
387  xsens_gps_arm_y = XSENS_ReqLeverArmGpsAck_y(xsens_msg_buf);
388  xsens_gps_arm_z = XSENS_ReqLeverArmGpsAck_z(xsens_msg_buf);
389 
392  } else if (xsens_id == XSENS_Error_ID) {
393  xsens_errorcode = XSENS_Error_errorcode(xsens_msg_buf);
394  } else if (xsens_id == XSENS_MTData2_ID) {
395  for (offset = 0; offset < xsens_len;) {
396  uint8_t code1 = xsens_msg_buf[offset];
397  uint8_t code2 = xsens_msg_buf[offset + 1];
398  int subpacklen = (int)xsens_msg_buf[offset + 2];
399  offset += 3;
400 
401 
402  if (code1 == 0x10) {
403  if (code2 == 0x10) {
404  // UTC
405  } else if (code2 == 0x20) {
406  // Packet Counter
407  }
408  if (code2 == 0x30) {
409  // ITOW
410  }
411  } else if (code1 == 0x20) {
412  if (code2 == 0x30) {
413  // Attitude Euler
414  ins_phi = XSENS_DATA_Euler_roll(xsens_msg_buf, offset) * M_PI / 180;
415  ins_theta = XSENS_DATA_Euler_pitch(xsens_msg_buf, offset) * M_PI / 180;
416  ins_psi = XSENS_DATA_Euler_yaw(xsens_msg_buf, offset) * M_PI / 180;
417 
418  new_ins_attitude = 1;
419 
420  }
421  } else if (code1 == 0x40) {
422  if (code2 == 0x10) {
423  // Delta-V
424  ins_ax = XSENS_DATA_Acceleration_x(xsens_msg_buf, offset) * 100.0f;
425  ins_ay = XSENS_DATA_Acceleration_y(xsens_msg_buf, offset) * 100.0f;
426  ins_az = XSENS_DATA_Acceleration_z(xsens_msg_buf, offset) * 100.0f;
427  }
428  } else if (code1 == 0x80) {
429  if (code2 == 0x20) {
430  // Rate Of Turn
431  ins_p = XSENS_DATA_RateOfTurn_x(xsens_msg_buf, offset) * M_PI / 180;
432  ins_q = XSENS_DATA_RateOfTurn_y(xsens_msg_buf, offset) * M_PI / 180;
433  ins_r = XSENS_DATA_RateOfTurn_z(xsens_msg_buf, offset) * M_PI / 180;
434  }
435  } else if (code1 == 0x30) {
436  if (code2 == 0x10) {
437  // Baro Pressure
438  }
439  } else if (code1 == 0xE0) {
440  if (code2 == 0x20) {
441  // Status Word
442  xsens_msg_statusword = XSENS_DATA_StatusWord_status(xsens_msg_buf, offset);
443  //gps.tow = xsens_msg_statusword;
444 #if USE_GPS_XSENS
445  if (bit_is_set(xsens_msg_statusword, 2) && bit_is_set(xsens_msg_statusword, 1)) {
446  if (bit_is_set(xsens_msg_statusword, 23) && bit_is_set(xsens_msg_statusword, 24)) {
447  gps.fix = GPS_FIX_3D;
448  } else {
449  gps.fix = GPS_FIX_2D;
450  }
451  } else { gps.fix = GPS_FIX_NONE; }
452 #endif
453  }
454  } else if (code1 == 0x88) {
455  if (code2 == 0x40) {
456  gps.week = XSENS_DATA_GpsSol_week(xsens_msg_buf, offset);
457  gps.num_sv = XSENS_DATA_GpsSol_numSv(xsens_msg_buf, offset);
458  gps.pacc = XSENS_DATA_GpsSol_pAcc(xsens_msg_buf, offset);
459  gps.sacc = XSENS_DATA_GpsSol_sAcc(xsens_msg_buf, offset);
460  gps.pdop = XSENS_DATA_GpsSol_pDop(xsens_msg_buf, offset);
461  } else if (code2 == 0xA0) {
462  // SVINFO
463  gps.tow = XSENS_XDI_GpsSvInfo_iTOW(xsens_msg_buf + offset);
464 
465 #if USE_GPS_XSENS
466  gps.nb_channels = XSENS_XDI_GpsSvInfo_nch(xsens_msg_buf + offset);
467 
470 
471  uint8_t i;
472  // Do not write outside buffer
473  for (i = 0; i < Min(gps.nb_channels, GPS_NB_CHANNELS); i++) {
474  uint8_t ch = XSENS_XDI_GpsSvInfo_chn(xsens_msg_buf + offset, i);
475  if (ch > gps.nb_channels) { continue; }
476  gps.svinfos[ch].svid = XSENS_XDI_GpsSvInfo_svid(xsens_msg_buf + offset, i);
477  gps.svinfos[ch].flags = XSENS_XDI_GpsSvInfo_bitmask(xsens_msg_buf + offset, i);
478  gps.svinfos[ch].qi = XSENS_XDI_GpsSvInfo_qi(xsens_msg_buf + offset, i);
479  gps.svinfos[ch].cno = XSENS_XDI_GpsSvInfo_cnr(xsens_msg_buf + offset, i);
480  }
481 #endif
482  }
483  } else if (code1 == 0x50) {
484  if (code2 == 0x10) {
485  //gps.hmsl = XSENS_DATA_Altitude_h(xsens_msg_buf,offset)* 1000.0f;
486  } else if (code2 == 0x20) {
487  // Altitude Elipsoid
488  gps.utm_pos.alt = XSENS_DATA_Altitude_h(xsens_msg_buf, offset) * 1000.0f;
489 
490  // Compute geoid (MSL) height
491  float geoid_h = wgs84_ellipsoid_to_geoid(lla_f.lat, lla_f.lon);
492  gps.hmsl = gps.utm_pos.alt - (geoid_h * 1000.0f);
493 
494  //gps.tow = geoid_h * 1000.0f; //gps.utm_pos.alt;
495  } else if (code2 == 0x40) {
496  // LatLong
497 #ifdef GPS_LED
498  LED_TOGGLE(GPS_LED);
499 #endif
502  gps.week = 0; // FIXME
503  lla_f.lat = RadOfDeg(XSENS_DATA_LatLon_lat(xsens_msg_buf, offset));
504  lla_f.lon = RadOfDeg(XSENS_DATA_LatLon_lon(xsens_msg_buf, offset));
505 
506  // Set the real UTM zone
507  gps.utm_pos.zone = (DegOfRad(lla_f.lon) + 180) / 6 + 1;
508 
510  // convert to utm
512  // copy results of utm conversion
513  gps.utm_pos.east = utm_f.east * 100;
514  gps.utm_pos.north = utm_f.north * 100;
515 
516  gps_xsens_publish();
517  }
518  } else if (code1 == 0xD0) {
519  if (code2 == 0x10) {
520  // Velocity
521  ins_vx = ((INS_FORMAT)XSENS_DATA_VelocityXYZ_x(xsens_msg_buf, offset));
522  ins_vy = ((INS_FORMAT)XSENS_DATA_VelocityXYZ_y(xsens_msg_buf, offset));
523  ins_vz = ((INS_FORMAT)XSENS_DATA_VelocityXYZ_z(xsens_msg_buf, offset));
524  gps.ned_vel.x = ins_vx;
525  gps.ned_vel.y = ins_vy;
526  gps.ned_vel.z = ins_vx;
527  }
528  }
529 
530  if (subpacklen < 0) {
531  subpacklen = 0;
532  }
533  offset += subpacklen;
534  }
535 
536 
537  /*
538 
539  gps.pacc = XSENS_DATA_RAWGPS_hacc(xsens_msg_buf,offset) / 100;
540  gps.sacc = XSENS_DATA_RAWGPS_sacc(xsens_msg_buf,offset) / 100;
541  gps.pdop = 5; // FIXME Not output by XSens
542  */
543 
544  /*
545  */
546 
547 
548  /*
549  ins_mx = XSENS_DATA_Calibrated_magX(xsens_msg_buf,offset);
550  ins_my = XSENS_DATA_Calibrated_magY(xsens_msg_buf,offset);
551  ins_mz = XSENS_DATA_Calibrated_magZ(xsens_msg_buf,offset);
552  */
553 
554 
555  /*
556  xsens_time_stamp = XSENS_DATA_TimeStamp_ts(xsens_msg_buf,offset);
557  #if USE_GPS_XSENS
558  gps.tow = xsens_time_stamp;
559  #endif
560  */
561 
562  }
563 
564 }
565 
566 
568 {
569  ck += c;
570  switch (xsens_status) {
571  case UNINIT:
572  if (c != XSENS_START) {
573  goto error;
574  }
575  xsens_status++;
576  ck = 0;
577  break;
578  case GOT_START:
579  if (c != XSENS_BID) {
580  goto error;
581  }
582  xsens_status++;
583  break;
584  case GOT_BID:
585  xsens_id = c;
586  xsens_status++;
587  break;
588  case GOT_MID:
589  xsens_len = c;
591  goto error;
592  }
593  xsens_msg_idx = 0;
594  xsens_status++;
595  break;
596  case GOT_LEN:
598  xsens_msg_idx++;
599  if (xsens_msg_idx >= xsens_len) {
600  xsens_status++;
601  }
602  break;
603  case GOT_DATA:
604  if (ck != 0) {
605  goto error;
606  }
608  goto restart;
609  break;
610  default:
611  break;
612  }
613  return;
614 error:
615 restart:
617  return;
618 }
uint8_t qi
quality bitfield (GPS receiver specific)
Definition: gps.h:60
#define GOT_LEN
Definition: ins_xsens700.c:123
Event structure to store callbacks in a linked list.
Definition: abi_common.h:65
unsigned short uint16_t
Definition: types.h:16
float xsens_gps_arm_z
Definition: ins_xsens700.c:141
int32_t north
in centimeters
static void stateSetNedToBodyEulers_f(struct FloatEulers *ned_to_body_eulers)
Set vehicle body attitude from euler angles (float).
Definition: state.h:1076
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
Definition: gps.h:87
#define UNINIT
Definition: ins_xsens700.c:119
int8_t xsens_month
Definition: ins_xsens700.c:149
float east
in meters
#define Min(x, y)
#define XsensTrailer()
Definition: ins_xsens700.c:109
uint32_t pacc
position accuracy in cm
Definition: gps.h:77
INS_FORMAT ins_phi
Definition: ins_xsens700.c:62
int8_t xsens_hour
Definition: ins_xsens700.c:144
uint8_t xsens_errorcode
Definition: ins_xsens700.c:133
float north
in meters
INS_FORMAT ins_psi
Definition: ins_xsens700.c:64
static void xsens_ask_message_rate(uint8_t c1, uint8_t c2, uint8_t freq)
Definition: ins_xsens700.c:248
void parse_ins_msg(void)
Definition: ins_xsens700.c:382
uint8_t nb_channels
Number of scanned satellites.
Definition: gps.h:86
int8_t xsens_min
Definition: ins_xsens700.c:145
INS_FORMAT ins_y
Definition: ins_xsens700.c:53
INS_FORMAT ins_az
Definition: ins_xsens700.c:74
#define XsensSend1ByAddr(x)
Definition: ins_xsens700.c:98
uint16_t week
GPS week.
Definition: gps.h:83
int8_t xsens_sec
Definition: ins_xsens700.c:146
Main include for ABI (AirBorneInterface).
INS_FORMAT ins_mx
Definition: ins_xsens700.c:77
uint8_t nav_utm_zone0
Definition: common_nav.c:44
INS_FORMAT ins_my
Definition: ins_xsens700.c:78
#define XSENS_MAX_PAYLOAD
Includes macros generated from xsens_MTi-G.xml.
Definition: ins_xsens700.c:115
Integrated Navigation System interface.
position in UTM coordinates Units: meters
int32_t east
in centimeters
uint8_t svid
Satellite ID.
Definition: gps.h:58
int8_t xsens_day
Definition: ins_xsens700.c:150
static uint8_t ck
Definition: ins_xsens700.c:156
uint16_t speed_3d
norm of 3d speed in cm/s
Definition: gps.h:75
#define GPS_FIX_3D
3D GPS fix
Definition: gps.h:43
#define INS_ROLL_NEUTRAL_DEFAULT
Definition: ahrs_sim.c:43
int32_t z
Down.
INS_FORMAT ins_ax
Definition: ins_xsens700.c:72
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over ellipsoid)
Definition: gps.h:70
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
Definition: gps.h:89
float xsens_gps_arm_x
Definition: ins_xsens700.c:139
WGS-84 Geoid Heights.
static uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Definition: sys_time_arch.h:39
euler angles
uint32_t sacc
speed accuracy in cm/s
Definition: gps.h:78
#define LED_TOGGLE(i)
Definition: led_hw.h:44
int32_t y
East.
uint32_t last_msg_time
cpu time in sec at last received GPS message
Definition: gps.h:92
INS_FORMAT ins_r
Definition: ins_xsens700.c:69
static void stateSetPositionUtm_f(struct UtmCoor_f *utm_pos)
Set position from UTM coordinates (float).
Definition: state.h:565
uint8_t zone
UTM zone number.
int32_t xsens_nanosec
Definition: ins_xsens700.c:147
Paparazzi floating point math for geodetic calculations.
static abi_event gps_ev
Definition: ahrs_infrared.c:58
vector in Latitude, Longitude and Altitude
uint32_t xsens_msg_statusword
Definition: ins_xsens700.c:134
float xsens_gps_arm_y
Definition: ins_xsens700.c:140
INS_FORMAT ins_vy
Definition: ins_xsens700.c:58
#define GPS_XSENS_ID
static void stateSetSpeedNed_f(struct NedCoor_f *ned_speed)
Set ground speed in local NED coordinates (float).
Definition: state.h:792
#define TRUE
Definition: std.h:4
void parse_ins_buffer(uint8_t c)
Definition: ins_xsens700.c:567
static uint8_t xsens_len
Definition: ins_xsens700.c:154
#define GOT_DATA
Definition: ins_xsens700.c:124
struct LlaCoor_f lla_f
Definition: ins_xsens700.c:159
int32_t hmsl
height above mean sea level in mm
Definition: gps.h:71
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
Definition: gps.h:61
int32_t nav_utm_north0
Definition: common_nav.c:43
vector in North East Down coordinates Units: meters
volatile int xsens_configured
Definition: ins_xsens700.c:162
static uint8_t xsens_id
Definition: ins_xsens700.c:152
Architecture independent timing functions.
data structure for GPS information
Definition: gps.h:67
uint32_t tow
GPS time of week in ms.
Definition: gps.h:84
void xsens_periodic(void)
Definition: ins_xsens700.c:257
#define GPS_FIX_NONE
No GPS fix.
Definition: gps.h:41
#define GPS_FIX_2D
2D GPS fix
Definition: gps.h:42
uint32_t xsens_output_settings
Definition: ins_xsens700.c:137
Device independent GPS code (interface)
uint16_t pdop
position dilution of precision scaled by 100
Definition: gps.h:80
volatile uint8_t ins_msg_received
Definition: ins_xsens700.c:92
int32_t x
North.
unsigned long uint32_t
Definition: types.h:18
INS_FORMAT ins_mz
Definition: ins_xsens700.c:79
signed short int16_t
Definition: types.h:17
static uint16_t c1
Definition: baro_MS5534A.c:203
uint16_t foo
Definition: main_demo5.c:59
INS_FORMAT ins_vx
Definition: ins_xsens700.c:57
#define INS_PITCH_NEUTRAL_DEFAULT
Definition: ahrs_sim.c:46
uint8_t zone
UTM zone number.
INS_FORMAT ins_theta
Definition: ins_xsens700.c:63
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
Definition: sys_time.h:70
struct UtmCoor_f utm_f
Definition: ins_xsens700.c:160
float ins_pitch_neutral
Definition: ins_arduimu.c:15
INS_FORMAT ins_q
Definition: ins_xsens700.c:68
signed long int32_t
Definition: types.h:19
#define GOT_START
Definition: ins_xsens700.c:120
#define INS_FORMAT
Definition: ins_module.h:35
INS_FORMAT ins_vz
Definition: ins_xsens700.c:59
#define GOT_MID
Definition: ins_xsens700.c:122
static void gps_cb(uint8_t sender_id, uint32_t stamp, struct GpsState *gps_s)
Definition: ahrs_infrared.c:68
static float wgs84_ellipsoid_to_geoid(float lat, float lon)
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
Definition: gps.h:90
int32_t alt
in millimeters above WGS84 reference ellipsoid
unsigned char uint8_t
Definition: types.h:14
API to get/set the generic vehicle states.
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
Definition: gps.h:76
volatile uint8_t new_ins_attitude
void xsens_init(void)
Definition: ins_xsens700.c:166
volatile uint32_t nb_sec
full seconds since startup
Definition: sys_time.h:69
INS_FORMAT ins_z
Definition: ins_xsens700.c:54
int32_t nav_utm_east0
Definition: common_nav.c:42
static uint8_t xsens_msg_idx
Definition: ins_xsens700.c:155
static uint16_t c2
Definition: baro_MS5534A.c:203
#define GOT_BID
Definition: ins_xsens700.c:121
int16_t xsens_year
Definition: ins_xsens700.c:148
static uint8_t xsens_status
Definition: ins_xsens700.c:153
float xsens_declination
Definition: ins_xsens700.c:138
uint8_t flags
bitfield with GPS receiver specific flags
Definition: gps.h:59
float lon
in radians
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
Definition: gps.h:91
uint8_t num_sv
number of sat in fix
Definition: gps.h:81
void handle_ins_msg(void)
Definition: ins_xsens700.c:361
#define ABI_BROADCAST
Broadcast address.
Definition: abi_common.h:56
uint16_t gspeed
norm of 2d ground speed in cm/s
Definition: gps.h:74
float lat
in radians
uint8_t xsens_msg_buf[XSENS_MAX_PAYLOAD]
Definition: ins_xsens700.c:116
float ins_roll_neutral
Definition: ins_arduimu.c:14
INS_FORMAT ins_x
Definition: ins_xsens700.c:52
uint16_t xsens_output_mode
Definition: ins_xsens700.c:136
INS_FORMAT ins_ay
Definition: ins_xsens700.c:73
signed char int8_t
Definition: types.h:15
static void stateSetBodyRates_f(struct FloatRates *body_rate)
Set vehicle body angular rate (float).
Definition: state.h:1152
uint8_t fix
status of fix
Definition: gps.h:82
void ins_register_impl(InsInit init)
Definition: ins.c:53
struct NedCoor_i ned_vel
speed NED in cm/s
Definition: gps.h:73
uint16_t xsens_time_stamp
Definition: ins_xsens700.c:135
static void stateSetLocalUtmOrigin_f(struct UtmCoor_f *utm_def)
Set the local (flat earth) coordinate frame origin from UTM (float).
Definition: state.h:460
struct GpsState gps
global GPS state
Definition: gps.c:41
INS_FORMAT ins_p
Definition: ins_xsens700.c:67
angular rates
Device independent INS code.
#define XsensHeader(msg_id, len)
Definition: ins_xsens700.c:102
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)
uint8_t send_ck
Definition: ins_xsens700.c:157