Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mag_pitot_uart.c
Go to the documentation of this file.
1/*
2 * Copyright (C) C. De Wagter
3 * Copyright (C) 2015 Freek van Tienen <freek.v.tienen@gmail.com>
4 *
5 * This file is part of paparazzi
6 *
7 * paparazzi is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * paparazzi is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with paparazzi; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
20 */
28
29#include "pprzlink/pprz_transport.h"
30#include "pprzlink/intermcu_msg.h"
31#include "mcu_periph/uart.h"
32#include "modules/core/abi.h"
33#include "modules/imu/imu.h"
34#include "state.h"
35
36/* Main magneto structure */
37static struct mag_pitot_t mag_pitot = {
39 .msg_available = false
40};
42
43/* Initialize the magneto and pitot */
45 // Initialize transport protocol
47
48 // Set the Imu to Magneto rotation
52}
53
54/* Parse the InterMCU message */
55static inline void mag_pitot_parse_msg(void)
56{
58
59 /* Parse the mag-pitot message */
61
62#if PPRZLINK_DEFAULT_VER == 2
63 // Check that the message is really a intermcu message
65#endif
66 switch (msg_id) {
67 /* Got a magneto message */
68 case DL_IMCU_REMOTE_MAG: {
69 struct Int32Vect3 raw_mag, mag;
70
71 // Read the raw magneto information
75
76 // Rotate the magneto
79
80 // Send and set the magneto IMU data
82 break;
83 }
84
85 /* Got a barometer message */
89
92 break;
93 }
94
95 /* Got an airspeed message */
97 // Should be updated to differential pressure
100 break;
101 }
102
103 default:
104 break;
105 }
106#if PPRZLINK_DEFAULT_VER == 2
107 }
108#endif
109}
110
111/* We need to wait for incomming messages */
113 // Check if we got some message from the Magneto or Pitot
115
116 // If we have a message we should parse it
119 mag_pitot.msg_available = false;
120 }
121}
122
123
Main include for ABI (AirBorneInterface).
#define IMU_MAG_PITOT_ID
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
euler angles
void int32_rmat_vmult(struct Int32Vect3 *vb, struct Int32RMat *m_a2b, struct Int32Vect3 *va)
rotate 3D vector by rotation matrix.
rotation matrix
static void orientationSetEulers_f(struct OrientationReps *orientation, struct FloatEulers *eulers)
Set vehicle body attitude from euler angles (float).
static struct Int32RMat * orientationGetRMat_i(struct OrientationReps *orientation)
Get vehicle body attitude rotation matrix (int).
Inertial Measurement Unit interface.
void mag_pitot_init()
static void mag_pitot_parse_msg(void)
static uint8_t mp_msg_buf[128]
The message buffer for the Magneto and pitot.
static struct mag_pitot_t mag_pitot
void mag_pitot_event()
bool msg_available
If we received a message.
struct link_device * device
The device which is uses for communication.
struct pprz_transport transport
The transport layer (PPRZ)
struct OrientationReps imu_to_mag
IMU to magneto translation.
#define IMU_TO_MAG_THETA
#define IMU_TO_MAG_PSI
#define IMU_TO_MAG_PHI
uint16_t foo
Definition main_demo5.c:58
API to get/set the generic vehicle states.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.