Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
actuators_at.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2013 Freek van Tienen
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 
28 #include "actuators_at.h"
29 #include "generated/airframe.h"
30 #include "boards/ardrone/at_com.h"
31 
32 void actuators_init(void) {
33  init_at_com();
34 }
35 
37  //Calculate the thrus, roll, pitch and yaw from the PPRZ commands
38  float thrust = ((float)(commands[COMMAND_THRUST]-MAX_PPRZ/2) / (float)MAX_PPRZ)*2.0f;
39  float roll = ((float)commands[COMMAND_ROLL] / (float)MAX_PPRZ);
40  float pitch = ((float)commands[COMMAND_PITCH] / (float)MAX_PPRZ);
41  float yaw = ((float)commands[COMMAND_YAW] / (float)MAX_PPRZ);
42 
43  //Starting engine
46 
47  //Check emergency or stop engine
51  at_com_send_ref(0);
52 
53  //Calibration
56 
57  //Moving
59  at_com_send_pcmd(1, thrust, roll, pitch, yaw);
60 
61  //Keep alive (FIXME)
62  at_com_send_config("general:navdata_demo", "FALSE");
63 }
void at_com_send_pcmd(int mode, float thrust, float roll, float pitch, float yaw)
Definition: at_com.c:173
int16_t pprz_t
Definition: paparazzi.h:6
void at_com_send_ref(int bits)
Definition: at_com.c:166
void actuators_set(pprz_t commands[])
Definition: actuators_at.c:36
AHRS implementation for ardrone2-sdk based on AT-commands.
ardrone2-sdk actuators are driven by external software controller by AT-commands
uint32_t state
Definition: ahrs_ardrone2.h:39
uint32_t control_state
Definition: ahrs_ardrone2.h:40
pprz_t commands[COMMANDS_NB]
Storage of intermediate command values.
Definition: commands.c:30
void at_com_send_calib(int device)
Definition: at_com.c:190
void init_at_com(void)
Definition: at_com.c:55
void actuators_init(void)
Definition: actuators_at.c:32
#define MAX_PPRZ
Definition: paparazzi.h:8
Sending and receiving of AT-commands specified by the ardrone API.
struct AhrsARDrone ahrs_impl
Definition: ahrs_ardrone2.c:40
void at_com_send_config(char *key, char *value)
Definition: at_com.c:149