Skip to content

Commit 736514d

Browse files
acfloriaJaeyoung-Lim
authored andcommitted
Implement handling the hall measurements in the sensors module
1 parent e9772b1 commit 736514d

File tree

2 files changed

+447
-6
lines changed

2 files changed

+447
-6
lines changed
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
/****************************************************************************
2+
*
3+
* Copyright (c) 2021 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+
/**
35+
* Driver ID of the angle of attack vane (corresponds to sensor I2C address)
36+
*
37+
* setting -1 disables the vane, 0-3 correspond to hall driver IDs
38+
*
39+
* @min -1
40+
* @max 3
41+
* @reboot_required true
42+
* @group Sensor Calibration
43+
*/
44+
PARAM_DEFINE_INT32(CAL_AV_AOA_ID, -1);
45+
46+
/**
47+
* Angle of attack vane angular mounting offset in degrees
48+
*
49+
* This value is subtracted (as a bias) from the measured angle of attack
50+
*
51+
* @unit deg
52+
* @group Sensor Calibration
53+
*/
54+
PARAM_DEFINE_FLOAT(CAL_AV_AOA_OFF, 0.0);
55+
56+
/**
57+
* Minimum calibrated angle of attack vane angle in degrees
58+
*
59+
* @unit deg
60+
* @min -90.0
61+
* @max -1.0
62+
* @group Sensor Calibration
63+
*/
64+
PARAM_DEFINE_FLOAT(CAL_AV_AOA_MIN, -30.0);
65+
66+
/**
67+
* Maximum calibrated angle of attack vane angle in degrees
68+
*
69+
* @unit deg
70+
* @min 1.0
71+
* @max 90.0
72+
* @group Sensor Calibration
73+
*/
74+
PARAM_DEFINE_FLOAT(CAL_AV_AOA_MAX, 30.0);
75+
76+
/**
77+
* Reverse vane direction (mounting dependent)
78+
*
79+
* @min -1.0
80+
* @max 1.0
81+
* @value -1.0 Reverse
82+
* @value 1.0 Normal
83+
* @group Sensor Calibration
84+
*/
85+
PARAM_DEFINE_FLOAT(CAL_AV_AOA_REV, 1.0);
86+
87+
/**
88+
* Calibrated polynomial coefficient 0 (*1e7)
89+
*
90+
* y = p0 + p1 * x + p2 * x^2 + ...
91+
* y = vane angle in degrees
92+
* x = magnetic field measurement in Tesla (assumes use of hall effect sensor)
93+
*
94+
* @group Sensor Calibration
95+
*/
96+
PARAM_DEFINE_INT32(CAL_AV_AOA_P0, 0);
97+
98+
/**
99+
* Calibrated polynomial coefficient 1 (*1e7)
100+
*
101+
* y = p0 + p1 * x + p2 * x^2 + ...
102+
* y = angle in degrees
103+
* x = magnetic field measurement in Tesla (assumes use of hall effect sensor)
104+
*
105+
* @group Sensor Calibration
106+
*/
107+
PARAM_DEFINE_INT32(CAL_AV_AOA_P1, 0);
108+
109+
/**
110+
* Calibrated polynomial coefficient 2 (*1e7)
111+
*
112+
* y = p0 + p1 * x + p2 * x^2 + ...
113+
* y = angle in degrees
114+
* x = magnetic field measurement in Tesla (assumes use of hall effect sensor)
115+
*
116+
* @group Sensor Calibration
117+
*/
118+
PARAM_DEFINE_INT32(CAL_AV_AOA_P2, 0);
119+
120+
/**
121+
* Calibrated polynomial coefficient 3 (*1e7)
122+
*
123+
* y = p0 + p1 * x + p2 * x^2 + ...
124+
* y = angle in degrees
125+
* x = magnetic field measurement in Tesla (assumes use of hall effect sensor)
126+
*
127+
* @group Sensor Calibration
128+
*/
129+
PARAM_DEFINE_INT32(CAL_AV_AOA_P3, 0);
130+
131+
/**
132+
* Driver ID of the sideslip vane (corresponds to sensor I2C address)
133+
*
134+
* setting -1 disables the vane, 0-3 correspond to hall driver IDs
135+
*
136+
* @min -1
137+
* @max 3
138+
* @reboot_required true
139+
* @group Sensor Calibration
140+
*/
141+
PARAM_DEFINE_INT32(CAL_AV_SLIP_ID, -1);
142+
143+
/**
144+
* Sideslip vane angular mounting offset in degrees
145+
*
146+
* This value is subtracted (as a bias) from the measured sideslip
147+
*
148+
* @unit deg
149+
* @group Sensor Calibration
150+
*/
151+
PARAM_DEFINE_FLOAT(CAL_AV_SLIP_OFF, 0.0);
152+
153+
/**
154+
* Minimum calibrated sideslip vane angle in degrees
155+
*
156+
* @unit deg
157+
* @min -90.0
158+
* @max -1.0
159+
* @group Sensor Calibration
160+
*/
161+
PARAM_DEFINE_FLOAT(CAL_AV_SLIP_MIN, -30.0);
162+
163+
/**
164+
* Maximum calibrated sideslip vane angle in degrees
165+
*
166+
* @unit deg
167+
* @min 1.0
168+
* @max 90.0
169+
* @group Sensor Calibration
170+
*/
171+
PARAM_DEFINE_FLOAT(CAL_AV_SLIP_MAX, 30.0);
172+
173+
/**
174+
* Reverse vane direction (mounting dependent)
175+
*
176+
* @min -1.0
177+
* @max 1.0
178+
* @value -1.0 Reverse
179+
* @value 1.0 Normal
180+
* @group Sensor Calibration
181+
*/
182+
PARAM_DEFINE_FLOAT(CAL_AV_SLIP_REV, 1.0);
183+
184+
/**
185+
* Calibrated polynomial coefficient 0 (*1e7)
186+
*
187+
* y = p0 + p1 * x + p2 * x^2 + ...
188+
* y = vane angle in degrees
189+
* x = magnetic field measurement in Tesla (assumes use of hall effect sensor)
190+
*
191+
* @group Sensor Calibration
192+
*/
193+
PARAM_DEFINE_INT32(CAL_AV_SLIP_P0, 0);
194+
195+
/**
196+
* Calibrated polynomial coefficient 1 (*1e7)
197+
*
198+
* y = p0 + p1 * x + p2 * x^2 + ...
199+
* y = angle in degrees
200+
* x = magnetic field measurement in Tesla (assumes use of hall effect sensor)
201+
*
202+
* @group Sensor Calibration
203+
*/
204+
PARAM_DEFINE_INT32(CAL_AV_SLIP_P1, 0);
205+
206+
/**
207+
* Calibrated polynomial coefficient 2 (*1e7)
208+
*
209+
* y = p0 + p1 * x + p2 * x^2 + ...
210+
* y = angle in degrees
211+
* x = magnetic field measurement in Tesla (assumes use of hall effect sensor)
212+
*
213+
* @group Sensor Calibration
214+
*/
215+
PARAM_DEFINE_INT32(CAL_AV_SLIP_P2, 0);
216+
217+
/**
218+
* Calibrated polynomial coefficient 3 (*1e7)
219+
*
220+
* y = p0 + p1 * x + p2 * x^2 + ...
221+
* y = angle in degrees
222+
* x = magnetic field measurement in Tesla (assumes use of hall effect sensor)
223+
*
224+
* @group Sensor Calibration
225+
*/
226+
PARAM_DEFINE_INT32(CAL_AV_SLIP_P3, 0);

0 commit comments

Comments
 (0)