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
ballistic_touchdown.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 Ewoud Smeur
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
23#include "state.h"
24
25float g = -9.81f;
26
28
30 // nothing to be done here
31}
32
39
40 struct EnuCoor_f * v = stateGetSpeedEnu_f();
41 float vz = v->z;
42
43 struct FloatVect2 vh;
44 VECT2_ASSIGN(vh, v->x, v->y);
45
46 float h = fabsf(stateGetPositionEnu_f()->z); // Should be height above ground, make sure to initialize local frame on ground
47
48 // With h always larger than 0, the sqrt can never give nan
49 float time_fall = (-vz - sqrtf(vz*vz -2.f*h*g))/g;
50
52
54
55 struct FloatVect2 pos;
56 pos.x = stateGetPositionEnu_f()->x;
57 pos.y = stateGetPositionEnu_f()->y;
58
59 // The predicted crash position is the current drone position + fall distance
61}
static void h(const real32_T x[7], const real32_T q[4], real32_T y[6])
void ballistic_touchdown_init(void)
void ballistic_touchdown_run(void)
Function that predicts the ballistic crash location.
float g
struct FloatVect2 ballistic_pos
#define VECT2_SMUL(_vo, _vi, _s)
#define VECT2_SUM(_c, _a, _b)
#define VECT2_ASSIGN(_a, _x, _y)
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
Definition state.h:848
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
Definition state.h:1058
uint16_t foo
Definition main_demo5.c:58
float y
in meters
float x
in meters
float z
in meters
vector in East North Up coordinates Units: meters
API to get/set the generic vehicle states.