Skip to content

Commit 0f4eaec

Browse files
authored
Merge pull request #17 from ethz-asl/feature/add_hall_effect_sensor
[WIP!!!] Feature/add hall effect sensor
2 parents 54cc96f + 2b4540a commit 0f4eaec

27 files changed

+1590
-4
lines changed

ROMFS/px4fmu_common/init.d/rc.sensors

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,57 @@ then
114114
adis16448 -S start
115115
fi
116116

117+
# Hall effect sensors si7210
118+
# Potentially remove the -k option if possible and improve the startup if possible
119+
if param greater CAL_AV_AOA_ID -1
120+
then
121+
set AOA_I2C_ID 0
122+
if param compare CAL_AV_AOA_ID 48
123+
then
124+
set AOA_I2C_ID 48
125+
fi
126+
if param compare CAL_AV_AOA_ID 49
127+
then
128+
set AOA_I2C_ID 49
129+
fi
130+
if param compare CAL_AV_AOA_ID 50
131+
then
132+
set AOA_I2C_ID 50
133+
fi
134+
if param compare CAL_AV_AOA_ID 51
135+
then
136+
set AOA_I2C_ID 51
137+
fi
138+
139+
si7210 start -X -k -a ${AOA_I2C_ID}
140+
unset AOA_I2C_ID
141+
fi
142+
143+
if param greater CAL_AV_SLIP_ID -1
144+
then
145+
set SLIP_I2C_ID 0
146+
if param compare CAL_AV_SLIP_ID 48
147+
then
148+
set SLIP_I2C_ID 48
149+
fi
150+
if param compare CAL_AV_SLIP_ID 49
151+
then
152+
set SLIP_I2C_ID 49
153+
fi
154+
if param compare CAL_AV_SLIP_ID 50
155+
then
156+
set SLIP_I2C_ID 50
157+
fi
158+
if param compare CAL_AV_SLIP_ID 51
159+
then
160+
set SLIP_I2C_ID 51
161+
fi
162+
163+
si7210 start -X -k -a ${SLIP_I2C_ID}
164+
unset SLIP_I2C_ID
165+
fi
166+
167+
117168
# probe for optional external I2C devices
118169
if param compare SENS_EXT_I2C_PRB 1
119170
then

boards/px4/fmu-v3/default.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ px4_add_board(
4141
magnetometer # all available magnetometer drivers
4242
optical_flow # all available optical flow drivers
4343
osd
44+
si7210
4445
pca9685
4546
pca9685_pwm_out
4647
#power_monitor/ina226

boards/px4/fmu-v5/default.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ px4_add_board(
5050
roboclaw
5151
rpm
5252
safety_button
53+
si7210
5354
telemetry # all available telemetry drivers
5455
test_ppm
5556
tone_alarm

msg/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ set(msg_files
3939
actuator_controls.msg
4040
actuator_outputs.msg
4141
adc_report.msg
42+
airflow_aoa.msg
43+
airflow_slip.msg
4244
airspeed.msg
4345
airspeed_validated.msg
4446
airspeed_wind.msg
@@ -128,6 +130,7 @@ set(msg_files
128130
sensor_baro.msg
129131
sensor_combined.msg
130132
sensor_correction.msg
133+
sensor_hall.msg
131134
sensor_gps.msg
132135
sensor_gyro.msg
133136
sensor_gyro_fft.msg

msg/airflow_aoa.msg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
uint64 timestamp # time since system start (microseconds)
2+
float32 aoa_rad # angle of attack in radians
3+
bool valid # true if measurement is within sensor/calibration range, false otherwise

msg/airflow_slip.msg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
uint64 timestamp # time since system start (microseconds)
2+
float32 slip_rad # sideslip angle in radians
3+
bool valid # true if measurement is within sensor/calibration range, false otherwise

msg/sensor_hall.msg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
uint64 timestamp # time since system start (microseconds)
2+
3+
int8 instance # sensor instance
4+
5+
float32 mag_t # magnetic field measurement in Tesla
6+
7+
float32 temp_c # temperature measurement in deg C

msg/tools/uorb_rtps_message_ids.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ rtps:
342342
id: 158
343343
- msg: estimator_event_flags
344344
id: 159
345+
- msg: sensor_hall
346+
id: 160
345347
########## multi topics: begin ##########
346348
- msg: actuator_controls_0
347349
id: 170

src/drivers/drv_hall.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/****************************************************************************
2+
*
3+
* Copyright (c) 2012-2018 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+
* @file drv_hall.h
36+
*
37+
* Hall Effect Magnetic Sensor driver interface.
38+
*/
39+
40+
#ifndef _DRV_HALL_H
41+
#define _DRV_HALL_H
42+
43+
#include <stdint.h>
44+
#include <sys/ioctl.h>
45+
46+
#include "drv_sensor.h"
47+
#include "drv_orb_dev.h"
48+
49+
#define HALL_BASE_DEVICE_PATH "/dev/hall"
50+
#define HALL0_DEVICE_PATH "/dev/hall0"
51+
#define HALL1_DEVICE_PATH "/dev/hall1"
52+
#define HALL2_DEVICE_PATH "/dev/hall2"
53+
#define HALL3_DEVICE_PATH "/dev/hall3"
54+
55+
56+
#endif /* _DRV_HALL_H */

src/drivers/drv_sensor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@
177177
#define DRV_DIST_DEVTYPE_SIM 0x9a
178178
#define DRV_DIST_DEVTYPE_SRF05 0x9b
179179

180+
#define DRV_HALL_DEVTYPE_SI7210 0x9c
181+
180182
#define DRV_DEVTYPE_UNUSED 0xff
181183

182184
#endif /* _DRV_SENSOR_H */

0 commit comments

Comments
 (0)