MAV'RIC
servos_mix_quadcopter_cross.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_cross.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 cross configuration
40  *
41  ******************************************************************************/
42 
43 
44 #ifndef SERVOS_MIX_QUADCOPTER_CROSS_H_
45 #define SERVOS_MIX_QUADCOPTER_CROSS_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 {
71  uint8_t motor_front;
72  uint8_t motor_left;
73  uint8_t motor_right;
74  uint8_t motor_rear;
75  rot_dir_t motor_front_dir;
76  rot_dir_t motor_left_dir;
77  rot_dir_t motor_right_dir;
78  rot_dir_t motor_rear_dir;
79  float min_thrust;
80  float max_thrust;
82 
83 
87 typedef struct
88 {
89  uint8_t motor_front;
90  uint8_t motor_left;
91  uint8_t motor_right;
92  uint8_t motor_rear;
93  rot_dir_t motor_front_dir;
94  rot_dir_t motor_left_dir;
95  rot_dir_t motor_right_dir;
96  rot_dir_t motor_rear_dir;
97  float min_thrust;
98  float max_thrust;
103 
104 
114 void servo_mix_quadcotper_cross_init( servo_mix_quadcotper_cross_t* mix,
115  const servo_mix_quadcopter_cross_conf_t* config,
116  const torque_command_t* torque_command,
117  const thrust_command_t* thrust_command,
118  servos_t* servos);
119 
120 
126 void servos_mix_quadcopter_cross_update(servo_mix_quadcotper_cross_t* mix);
127 
128 
129 #ifdef __cplusplus
130  }
131 #endif
132 
133 #endif
rot_dir_t motor_rear_dir
Rear motor turning direction.
Definition: servos_mix_quadcopter_cross.h:78
rot_dir_t motor_rear_dir
Rear motor turning direction.
Definition: servos_mix_quadcopter_cross.h:96
Thrust command type.
Definition: control_command.h:151
rot_dir_t motor_right_dir
Right motor turning direction.
Definition: servos_mix_quadcopter_cross.h:95
Define the servos structure.
Definition: servos.h:82
Torque command structure.
Definition: control_command.h:142
const torque_command_t * torque_command
Pointer to the torque command structure.
Definition: servos_mix_quadcopter_cross.h:99
uint8_t motor_front
Front motor.
Definition: servos_mix_quadcopter_cross.h:71
servos_t * servos
Pointer to the servos structure.
Definition: servos_mix_quadcopter_cross.h:101
rot_dir_t motor_front_dir
Front motor turning direction.
Definition: servos_mix_quadcopter_cross.h:75
float min_thrust
Minimum thrust.
Definition: servos_mix_quadcopter_cross.h:79
uint8_t motor_right
Right motor.
Definition: servos_mix_quadcopter_cross.h:91
float max_thrust
Maximum thrust.
Definition: servos_mix_quadcopter_cross.h:98
rot_dir_t motor_right_dir
Right motor turning direction.
Definition: servos_mix_quadcopter_cross.h:77
uint8_t motor_rear
Rear motor.
Definition: servos_mix_quadcopter_cross.h:74
rot_dir_t motor_front_dir
Front motor turning direction.
Definition: servos_mix_quadcopter_cross.h:93
const thrust_command_t * thrust_command
Pointer to the thrust command structure.
Definition: servos_mix_quadcopter_cross.h:100
float max_thrust
Maximum thrust.
Definition: servos_mix_quadcopter_cross.h:80
uint8_t motor_front
Front motor.
Definition: servos_mix_quadcopter_cross.h:89
servos mix structure
Definition: servos_mix_quadcopter_cross.h:87
uint8_t motor_left
Left motor.
Definition: servos_mix_quadcopter_cross.h:90
uint8_t motor_right
Right motor.
Definition: servos_mix_quadcopter_cross.h:73
uint8_t motor_left
Left motor.
Definition: servos_mix_quadcopter_cross.h:72
The servo mix structure for a quad in cross shape.
Definition: servos_mix_quadcopter_cross.h:69
rot_dir_t motor_left_dir
Left motor turning direction.
Definition: servos_mix_quadcopter_cross.h:76
uint8_t motor_rear
Rear motor.
Definition: servos_mix_quadcopter_cross.h:92
rot_dir_t motor_left_dir
Left motor turning direction.
Definition: servos_mix_quadcopter_cross.h:94
float min_thrust
Minimum thrust.
Definition: servos_mix_quadcopter_cross.h:97