MAV'RIC
stabilisation_copter.h
1 /*******************************************************************************
2  * Copyright (c) 2009-2014, MAV'RIC Development Team
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  ******************************************************************************/
31 
32 /*******************************************************************************
33  * \file stabilisation_copter.h
34  *
35  * \author MAV'RIC Team
36  * \author Felix Schill
37  * \author Nicolas Dousse
38  *
39  * \brief This file handles the stabilization of the platform
40  *
41  ******************************************************************************/
42 
43 
44 #ifndef STABILISATION_COPTER_H_
45 #define STABILISATION_COPTER_H_
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 #include "stabilisation.h"
52 #include "imu.h"
53 #include "position_estimation.h"
54 #include "servos.h"
55 #include "mavlink_waypoint_handler.h"
56 
60 typedef enum
61 {
62  QUADCOPTER_MOTOR_LAYOUT_DIAG = 0,
63  QUADCOPTER_MOTOR_LAYOUT_CROSS = 1,
64 } quadcopter_motor_layout_t;
65 
66 
70 typedef struct
71 {
78 
82 typedef struct
83 {
85  quadcopter_motor_layout_t motor_layout;
88  const imu_t* imu;
89  const ahrs_t* ahrs;
93 
97 typedef struct
98 {
100  quadcopter_motor_layout_t motor_layout;
103 
117 bool stabilisation_copter_init(stabilisation_copter_t* stabilisation_copter, stabilisation_copter_conf_t* stabiliser_conf, control_command_t* controls, const imu_t* imu, const ahrs_t* ahrs, const position_estimation_t* pos_est,servos_t* servos);
118 
127 void stabilisation_copter_position_hold(stabilisation_copter_t* stabilisation_copter, const control_command_t* input, const mavlink_waypoint_handler_t* waypoint_handler, const position_estimation_t* position_estimation);
128 
134 void stabilisation_copter_cascade_stabilise(stabilisation_copter_t* stabilisation_copter);
135 
142 void stabilisation_copter_mix_to_servos_diag_quad(control_command_t *control, servos_t* servos);
143 
150 void stabilisation_copter_mix_to_servos_cross_quad(control_command_t *control, servos_t* servos);
151 
152 #ifdef __cplusplus
153 }
154 #endif
155 
156 #endif /* STABILISATION_COPTER_H_ */
servos_t * servos
The pointer to the servos structure.
Definition: stabilisation_copter.h:91
Structure containing the Attitude and Heading Reference System.
Definition: ahrs.h:58
stabiliser_t velocity_stabiliser
The velocity controller structure.
Definition: stabilisation_copter.h:74
Define the servos structure.
Definition: servos.h:82
Structure containing the configuration data.
Definition: stabilisation_copter.h:97
quadcopter_motor_layout_t motor_layout
Motor layout (cross or diag)
Definition: stabilisation_copter.h:100
const ahrs_t * ahrs
The pointer to the attitude estimation structure.
Definition: stabilisation_copter.h:89
control_command_t * controls
The pointer to the control structure.
Definition: stabilisation_copter.h:87
stabiliser_stack_copter_t stabiliser_stack
The pointer to the PID parameters values and output for the stacked controller.
Definition: stabilisation_copter.h:101
Structure containing the stacked controller.
Definition: stabilisation_copter.h:70
Structure containing the pointers to the data needed in this module.
Definition: stabilisation_copter.h:82
stabiliser_t rate_stabiliser
The rate controller structure.
Definition: stabilisation_copter.h:72
The control command typedef.
Definition: stabilisation.h:77
float thrust_hover_point
The hover point of the thrust.
Definition: stabilisation_copter.h:99
The IMU structure.
Definition: imu.h:108
float yaw_coordination_velocity
the yaw coordination value in velocity control mode
Definition: stabilisation_copter.h:76
The structure used to control the vehicle with 4 PIDs.
Definition: stabilisation.h:90
stabiliser_t position_stabiliser
The position controller structure.
Definition: stabilisation_copter.h:75
stabiliser_t attitude_stabiliser
The attitude controller structure.
Definition: stabilisation_copter.h:73
const imu_t * imu
The pointer to the IMU structure.
Definition: stabilisation_copter.h:88
float thrust_hover_point
The hover point of the thrust.
Definition: stabilisation_copter.h:84
stabiliser_stack_copter_t stabiliser_stack
The pointer to the PID parameters values for the stacked controller.
Definition: stabilisation_copter.h:86
const position_estimation_t * pos_est
The pointer to the position estimation structure.
Definition: stabilisation_copter.h:90
quadcopter_motor_layout_t motor_layout
Motor layout (cross or diag)
Definition: stabilisation_copter.h:85
The position estimator structure.
Definition: position_estimation.h:79