MAV'RIC
servos_mix_quadcopter_diag.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 servos_mix_quadcopter_diag.h
34  *
35  * \author MAV'RIC Team
36  * \author Julien Lecoeur
37  *
38  * \brief Links between torque commands and servos PWM command for quadcopters
39  * in diagonal configuration
40  *
41  ******************************************************************************/
42 
43 
44 #ifndef SERVOS_MIX_QUADCOPTER_DIAG_H_
45 #define SERVOS_MIX_QUADCOPTER_DIAG_H_
46 
47 #ifdef __cplusplus
48  extern "C" {
49 #endif
50 
51 
52 #include "control_command.h"
53 #include "servos.h"
54 
55 
59 typedef enum
60 {
61  CW = 1,
62  CCW = -1
63 } rot_dir_t;
64 
65 
69 typedef struct
70 {
72  uint8_t motor_front_left;
73  uint8_t motor_rear_right;
74  uint8_t motor_rear_left;
78  rot_dir_t motor_rear_left_dir;
79  float min_thrust;
80  float max_thrust;
82 
83 
87 typedef struct
88 {
90  uint8_t motor_front_left;
91  uint8_t motor_rear_right;
92  uint8_t motor_rear_left;
96  rot_dir_t motor_rear_left_dir;
97  float min_thrust;
98  float max_thrust;
103 
104 
116 bool servo_mix_quadcotper_diag_init(servo_mix_quadcotper_diag_t* mix,
117  const servo_mix_quadcopter_diag_conf_t* config,
118  const torque_command_t* torque_command,
119  const thrust_command_t* thrust_command,
120  servos_t* servos);
121 
122 
128 void servos_mix_quadcopter_diag_update(servo_mix_quadcotper_diag_t* mix);
129 
130 
131 #ifdef __cplusplus
132  }
133 #endif
134 
135 #endif
const torque_command_t * torque_command
Pointer to the torque command structure.
Definition: servos_mix_quadcopter_diag.h:99
const thrust_command_t * thrust_command
Pointer to the thrust command structure.
Definition: servos_mix_quadcopter_diag.h:100
Thrust command type.
Definition: control_command.h:151
uint8_t motor_rear_right
Right motor.
Definition: servos_mix_quadcopter_diag.h:91
float max_thrust
Maximum thrust.
Definition: servos_mix_quadcopter_diag.h:80
uint8_t motor_front_right
Front motor.
Definition: servos_mix_quadcopter_diag.h:89
servos_t * servos
Pointer to the servos structure.
Definition: servos_mix_quadcopter_diag.h:101
Define the servos structure.
Definition: servos.h:82
Torque command structure.
Definition: control_command.h:142
rot_dir_t motor_rear_right_dir
Right motor turning direction.
Definition: servos_mix_quadcopter_diag.h:95
uint8_t motor_front_left
Left motor.
Definition: servos_mix_quadcopter_diag.h:72
rot_dir_t motor_front_left_dir
Left motor turning direction.
Definition: servos_mix_quadcopter_diag.h:76
rot_dir_t motor_front_right_dir
Front motor turning direction.
Definition: servos_mix_quadcopter_diag.h:93
The servo mix structure for a quad in cross shape.
Definition: servos_mix_quadcopter_diag.h:69
rot_dir_t motor_rear_right_dir
Right motor turning direction.
Definition: servos_mix_quadcopter_diag.h:77
servos mix structure
Definition: servos_mix_quadcopter_diag.h:87
float min_thrust
Minimum thrust.
Definition: servos_mix_quadcopter_diag.h:97
uint8_t motor_rear_left
Rear motor.
Definition: servos_mix_quadcopter_diag.h:92
float max_thrust
Maximum thrust.
Definition: servos_mix_quadcopter_diag.h:98
uint8_t motor_rear_right
Right motor.
Definition: servos_mix_quadcopter_diag.h:73
rot_dir_t motor_rear_left_dir
Rear motor turning direction.
Definition: servos_mix_quadcopter_diag.h:78
uint8_t motor_front_right
Front motor.
Definition: servos_mix_quadcopter_diag.h:71
uint8_t motor_rear_left
Rear motor.
Definition: servos_mix_quadcopter_diag.h:74
rot_dir_t motor_front_left_dir
Left motor turning direction.
Definition: servos_mix_quadcopter_diag.h:94
rot_dir_t motor_front_right_dir
Front motor turning direction.
Definition: servos_mix_quadcopter_diag.h:75
rot_dir_t motor_rear_left_dir
Rear motor turning direction.
Definition: servos_mix_quadcopter_diag.h:96
float min_thrust
Minimum thrust.
Definition: servos_mix_quadcopter_diag.h:79
uint8_t motor_front_left
Left motor.
Definition: servos_mix_quadcopter_diag.h:90