Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
ahrs_vectornav_wrapper.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Michal Podhradsky, michal.podhradsky@aggiemail.usu.edu
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  */
29 #include "modules/ahrs/ahrs.h"
30 #include "modules/core/abi.h"
31 #include "state.h"
32 
33 PRINT_CONFIG_VAR(AHRS_VECTORNAV_TYPE)
34 
37 
38 #if PERIODIC_TELEMETRY
40 
41 static void send_euler(struct transport_tx *trans, struct link_device *dev)
42 {
43  pprz_msg_send_AHRS_EULER(trans, dev, AC_ID,
48 }
49 #endif
50 
52 {
54  if (AHRS_VECTORNAV_TYPE == AHRS_PRIMARY) {
56  } else {
58  }
59 
60 #if PERIODIC_TELEMETRY
61  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_AHRS_EULER, send_euler);
62 #endif
63 }
64 
66 {
67  if (enable) {
68  stateSetInputFilter(STATE_INPUT_ATTITUDE, MODULE_AHRS_VECTORNAV_ID);
69  stateSetInputFilter(STATE_INPUT_RATES, MODULE_AHRS_VECTORNAV_ID);
70  }
71  ahrs_vectornav_enable = enable;
72 }
73 
Main include for ABI (AirBorneInterface).
#define AHRS_COMP_ID_VECTORNAV
Definition: ahrs.h:46
#define AHRS_PRIMARY
Definition: ahrs.h:32
struct AhrsVectornav ahrs_vn
void ahrs_vectornav_init(void)
Initialize Vectornav struct.
struct VNData vn_data
Data struct.
void ahrs_vectornav_wrapper_init(void)
uint8_t ahrs_vectornav_enable
static uint8_t ahrs_vectornav_id
void ahrs_vectornav_wrapper_enable(uint8_t enable)
static void send_euler(struct transport_tx *trans, struct link_device *dev)
Vectornav VN-200 as AHRS.
#define STATE_INPUT_RATES
Definition: state.h:145
#define STATE_INPUT_ATTITUDE
Definition: state.h:144
float phi
in radians
float theta
in radians
float psi
in radians
void stateSetInputFilter(uint8_t type, uint16_t flag)
set the input filter for a specified type of data.
Definition: state.c:85
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
API to get/set the generic vehicle states.
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:51
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
struct FloatEulers attitude
Attitude, float, [rad], yaw, pitch, roll.
Definition: vn200_serial.h:87