MAV'RIC
velocity_controller_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 velocity_controller_copter.h
34  *
35  * \author MAV'RIC Team
36  * \author Felix Schill
37  * \author Nicolas Dousse
38  * \author Julien Lecoeur
39  *
40  * \brief A velocity controller for copters.
41  *
42  * \details It takes a velocity command as input and computes an attitude
43  * command as output. It is best suited for a hovering UAV with the thrust along
44  * its local -Z axis (like multicopters).
45  *
46  ******************************************************************************/
47 
48 
49 #ifndef VELOCITY_CONTROLLER_COPTER_H_
50 #define VELOCITY_CONTROLLER_COPTER_H_
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 #include "control_command.h"
57 #include "ahrs.h"
58 #include "pid_controller.h"
59 #include "position_estimation.h"
60 
64 typedef struct
65 {
68  const ahrs_t* ahrs;
74 
75 
79 typedef struct
80 {
81  pid_controller_conf_t pid_config[3];
83 
85 
86 
98 void velocity_controller_copter_init(velocity_controller_copter_t* controller, const velocity_controller_copter_conf_t* config, const ahrs_t* ahrs, const position_estimation_t* pos_est, const velocity_command_t* velocity_command, attitude_command_t* attitude_command, thrust_command_t* thrust_command);
99 
100 
106 void velocity_controller_copter_update(velocity_controller_copter_t* controller);
107 
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif /* VELOCITY_CONTROLLER_COPTER_H_ */
Structure containing the Attitude and Heading Reference System.
Definition: ahrs.h:58
attitude_command_t * attitude_command
Pointer to attitude command (output)
Definition: velocity_controller_copter.h:71
Thrust command type.
Definition: control_command.h:151
Velocity controller structure.
Definition: velocity_controller_copter.h:64
const position_estimation_t * pos_est
Speed and position estimation (input)
Definition: velocity_controller_copter.h:69
Configuration for PID controller.
Definition: pid_controller.h:81
thrust_command_t * thrust_command
Pointer to thrust command (output)
Definition: velocity_controller_copter.h:72
const velocity_command_t * velocity_command
Pointer to velocity command (input)
Definition: velocity_controller_copter.h:70
const ahrs_t * ahrs
Pointer to attitude estimation (input)
Definition: velocity_controller_copter.h:68
float thrust_hover_point
Amount of thrust required to hover (between -1 and 1)
Definition: velocity_controller_copter.h:82
PID controller.
Definition: pid_controller.h:95
Attitude command structure.
Definition: control_command.h:122
Velocity command structure.
Definition: control_command.h:81
Velocity controller configuration.
Definition: velocity_controller_copter.h:79
float thrust_hover_point
Amount of thrust required to hover (between -1 and 1)
Definition: velocity_controller_copter.h:67
The position estimator structure.
Definition: position_estimation.h:79