Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LS2N-drones
PX4-Autopilot
Commits
d9f3c820
Commit
d9f3c820
authored
Aug 20, 2021
by
Daniel Agar
Browse files
sensors: always start baro/GPS/mag aggregators if SYS_HAS_* set
- add new SYS_HAS_GPS parameter
parent
8e57a62c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/systemlib/system_params.c
View file @
d9f3c820
...
...
@@ -191,6 +191,20 @@ PARAM_DEFINE_INT32(SYS_CAL_TMIN, 5);
*/
PARAM_DEFINE_INT32
(
SYS_CAL_TMAX
,
10
);
/**
* Control if the vehicle has a GPS
*
* Disable this if the system has no GPS.
* If disabled, the sensors hub will not process sensor_gps,
* and GPS will not be available for the rest of the system.
*
* @boolean
* @reboot_required true
*
* @group System
*/
PARAM_DEFINE_INT32
(
SYS_HAS_GPS
,
1
);
/**
* Control if the vehicle has a magnetometer
*
...
...
src/modules/sensors/sensors.cpp
View file @
d9f3c820
...
...
@@ -219,6 +219,7 @@ private:
DEFINE_PARAMETERS
(
(
ParamBool
<
px4
::
params
::
SYS_HAS_BARO
>
)
_param_sys_has_baro
,
(
ParamBool
<
px4
::
params
::
SYS_HAS_GPS
>
)
_param_sys_has_gps
,
(
ParamBool
<
px4
::
params
::
SYS_HAS_MAG
>
)
_param_sys_has_mag
,
(
ParamBool
<
px4
::
params
::
SENS_IMU_MODE
>
)
_param_sens_imu_mode
)
...
...
@@ -534,12 +535,10 @@ void Sensors::InitializeVehicleAirData()
{
if
(
_param_sys_has_baro
.
get
())
{
if
(
_vehicle_air_data
==
nullptr
)
{
if
(
orb_exists
(
ORB_ID
(
sensor_baro
),
0
)
==
PX4_OK
)
{
_vehicle_air_data
=
new
VehicleAirData
();
_vehicle_air_data
=
new
VehicleAirData
();
if
(
_vehicle_air_data
)
{
_vehicle_air_data
->
Start
();
}
if
(
_vehicle_air_data
)
{
_vehicle_air_data
->
Start
();
}
}
}
...
...
@@ -547,8 +546,8 @@ void Sensors::InitializeVehicleAirData()
void
Sensors
::
InitializeVehicleGPSPosition
()
{
if
(
_
vehicle_gps_position
==
nullptr
)
{
if
(
orb_exists
(
ORB_ID
(
sensor_gps
),
0
)
==
PX4_OK
)
{
if
(
_
param_sys_has_gps
.
get
()
)
{
if
(
_vehicle_gps_position
==
nullptr
)
{
_vehicle_gps_position
=
new
VehicleGPSPosition
();
if
(
_vehicle_gps_position
)
{
...
...
@@ -602,12 +601,10 @@ void Sensors::InitializeVehicleMagnetometer()
{
if
(
_param_sys_has_mag
.
get
())
{
if
(
_vehicle_magnetometer
==
nullptr
)
{
if
(
orb_exists
(
ORB_ID
(
sensor_mag
),
0
)
==
PX4_OK
)
{
_vehicle_magnetometer
=
new
VehicleMagnetometer
();
_vehicle_magnetometer
=
new
VehicleMagnetometer
();
if
(
_vehicle_magnetometer
)
{
_vehicle_magnetometer
->
Start
();
}
if
(
_vehicle_magnetometer
)
{
_vehicle_magnetometer
->
Start
();
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment