PX4 Firmware
PX4 Autopilot Software http://px4.io
parameters.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright (c) 2016 PX4 Development Team. 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
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  * 3. Neither the name PX4 nor the names of its contributors may be
16  * used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  ****************************************************************************/
33 
34 #pragma once
35 
36 /**
37  * @file parameters.h
38  *
39  * defines the list of parameters that are used within the RCUpdate module
40  *
41  * @author Beat Kueng <beat-kueng@gmx.net>
42  */
43 #include <px4_platform_common/px4_config.h>
44 #include <drivers/drv_rc_input.h>
45 
46 #include <parameters/param.h>
47 #include <mathlib/mathlib.h>
48 
50 #include <uORB/topics/input_rc.h>
51 namespace RCUpdate
52 {
53 
54 static constexpr unsigned RC_MAX_CHAN_COUNT =
55  input_rc_s::RC_INPUT_MAX_CHANNELS; /**< maximum number of r/c channels we handle */
56 
57 struct Parameters {
64 
65  int32_t rc_map_roll;
66  int32_t rc_map_pitch;
67  int32_t rc_map_yaw;
68  int32_t rc_map_throttle;
69  int32_t rc_map_failsafe;
70 
71  int32_t rc_map_mode_sw;
76  int32_t rc_map_acro_sw;
78  int32_t rc_map_kill_sw;
79  int32_t rc_map_arm_sw;
80  int32_t rc_map_trans_sw;
81  int32_t rc_map_gear_sw;
82  int32_t rc_map_stab_sw;
83  int32_t rc_map_man_sw;
84  int32_t rc_map_flaps;
85 
86  int32_t rc_map_aux1;
87  int32_t rc_map_aux2;
88  int32_t rc_map_aux3;
89  int32_t rc_map_aux4;
90  int32_t rc_map_aux5;
91  int32_t rc_map_aux6;
92 
93  int32_t rc_map_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN];
94 
96 
97  int32_t rc_fails_thr;
98  float rc_assist_th;
99  float rc_auto_th;
104  float rc_acro_th;
108  float rc_trans_th;
109  float rc_gear_th;
110  float rc_stab_th;
111  float rc_man_th;
112 
127 
130 };
131 
138 
144 
159 
166 
167  param_t rc_map_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN];
168  param_t rc_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN]; /**< param handles for the parameters which are bound
169  to a RC channel, equivalent float values in the
170  _parameters struct are not existing
171  because these parameters are never read. */
172 
174 
190 
193 };
194 
195 /**
196  * initialize ParameterHandles struct
197  */
198 void initialize_parameter_handles(ParameterHandles &parameter_handles);
199 
200 
201 /**
202  * Read out the parameters using the handles into the parameters struct.
203  * @return 0 on success, <0 on error
204  */
205 int update_parameters(const ParameterHandles &parameter_handles, Parameters &parameters);
206 
207 } /* namespace RCUpdate */
static constexpr unsigned RC_MAX_CHAN_COUNT
maximum number of r/c channels we handle
Definition: parameters.h:54
float max[RC_MAX_CHAN_COUNT]
Definition: parameters.h:60
R/C input interface.
float min[RC_MAX_CHAN_COUNT]
Definition: parameters.h:58
float dz[RC_MAX_CHAN_COUNT]
Definition: parameters.h:62
float trim[RC_MAX_CHAN_COUNT]
Definition: parameters.h:59
int32_t rc_map_posctl_sw
Definition: parameters.h:74
int32_t rc_map_return_sw
Definition: parameters.h:72
int32_t rc_map_mode_sw
Definition: parameters.h:71
int32_t rc_map_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN]
Definition: parameters.h:93
Global flash based parameter store.
int32_t rc_map_rattitude_sw
Definition: parameters.h:73
int update_parameters(const ParameterHandles &parameter_handles, Parameters &parameters)
Read out the parameters using the handles into the parameters struct.
Definition: parameters.cpp:142
int32_t rc_map_failsafe
Definition: parameters.h:69
float rev[RC_MAX_CHAN_COUNT]
Definition: parameters.h:61
int32_t rc_map_flightmode
Definition: parameters.h:95
int32_t rc_map_offboard_sw
Definition: parameters.h:77
void initialize_parameter_handles(ParameterHandles &parameter_handles)
initialize ParameterHandles struct
Definition: parameters.cpp:45
int32_t rc_map_stab_sw
Definition: parameters.h:82
int32_t rc_map_acro_sw
Definition: parameters.h:76
int32_t rc_map_throttle
Definition: parameters.h:68
int32_t rc_map_loiter_sw
Definition: parameters.h:75
float scaling_factor[RC_MAX_CHAN_COUNT]
Definition: parameters.h:63
int32_t rc_map_trans_sw
Definition: parameters.h:80
int32_t rc_map_gear_sw
Definition: parameters.h:81
int32_t rc_map_kill_sw
Definition: parameters.h:78
uint32_t param_t
Parameter handle.
Definition: param.h:98