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
state2camera.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) Roland
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, see
18  * <http://www.gnu.org/licenses/>.
19  */
28 #include "subsystems/abi.h"
29 #include "state.h"
30 #include "mcu_periph/uart.h"
31 static int frame_number_sending = 0;
32 float lastKnownHeight = 0.0;
34 
36 {
37  struct Int32RMat *ltp_to_body_mat = stateGetNedToBodyRMat_i();
38  static int32_t lengthArrayInformation = 11 * sizeof(int32_t);
39  uint8_t ar[lengthArrayInformation];
40  int32_t *pointer = (int32_t *) ar;
41  for (int indexRot = 0; indexRot < 9; indexRot++) {
42  pointer[indexRot] = ltp_to_body_mat->m[indexRot];
43  }
44  pointer[9] = (int32_t)(state.alt_agl_f * 100); //height above ground level in CM.
45  pointer[10] = frame_number_sending++;
46  stereoprot_sendArray(&((UART_LINK).device), ar, lengthArrayInformation, 1);
47 }
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
static struct Int32RMat * stateGetNedToBodyRMat_i(void)
Get vehicle body attitude rotation matrix (int).
Definition: state.h:1090
int32_t m[3 *3]
Main include for ABI (AirBorneInterface).
standard protocol for TUDelft stereocamera data transfer
void stereoprot_sendArray(struct link_device *fd, uint8_t *b, uint8_t array_width, uint8_t array_height)
void write_serial_rot()
Definition: state2camera.c:35
signed long int32_t
Definition: types.h:19
float alt_agl_f
Altitude above ground level.
Definition: state.h:194
unsigned char uint8_t
Definition: types.h:14
API to get/set the generic vehicle states.
float lastKnownHeight
Definition: state2camera.c:32
int pleaseResetOdroid
Definition: state2camera.c:33
rotation matrix
static int frame_number_sending
Definition: state2camera.c:31
struct State state
Definition: state.c:36