-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: failure detector hitl #666
Conversation
… classes for handling failure injection messages(FailureDetectorHITL), simulating sensors that have ceased to update (FakeStuckSensor), and a component managing a collection of these simulated sensors (FakeSensors). This module is a combination of three classes: FailureDetectorHITL for detecting failure injection messages, FakeStuckSensor for simulating sensors whose readings have become stuck, and FakeSensors, a component that aggregates a collection of such simulated sensors. Additionally, the handling of the sensors module has been extended to support disabling sensors during flight. Designed exclusively for operation in HITL (Hardware-In-The-Loop) mode, this module does not interfere with normal operational mode. Reported-by: Ilia Loginov [email protected] On branch FEATURE_FAILURE_INJECTION_HITL Changes to be committed: modified: src/modules/sensors/CMakeLists.txt new file: src/modules/sensors/failure_detector_HITL/CMakeLists.txt new file: src/modules/sensors/failure_detector_HITL/failure_detector_HITL.cpp new file: src/modules/sensors/failure_detector_HITL/failure_detector_HITL.hpp modified: src/modules/sensors/sensors.cpp modified: src/modules/sensors/sensors.hpp
src/modules/sensors/sensors.cpp
Outdated
if (_hil_enabled) { | ||
#if defined(CONFIG_SENSORS_VEHICLE_GPS_POSITION) | ||
InitializeVehicleGPSPosition(); | ||
#endif // CONFIG_SENSORS_VEHICLE_GPS_POSITION | ||
|
||
#if defined(CONFIG_SENSORS_VEHICLE_AIR_DATA) | ||
InitializeVehicleAirData(); | ||
#endif // CONFIG_SENSORS_VEHICLE_AIR_DATA | ||
|
||
#if defined(CONFIG_SENSORS_VEHICLE_MAGNETOMETER) | ||
InitializeVehicleMagnetometer(); | ||
#endif // CONFIG_SENSORS_VEHICLE_MAGNETOMETER | ||
|
||
_fakeSensors.update(_failureDetector); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we move this block to be after this block at L256 ? and remove all the InitalizeVehicle* since there is now double Initialization in hitl case ?
#if defined(CONFIG_SENSORS_VEHICLE_AIR_DATA)
InitializeVehicleAirData();
#endif // CONFIG_SENSORS_VEHICLE_AIR_DATA
#if defined(CONFIG_SENSORS_VEHICLE_GPS_POSITION)
InitializeVehicleGPSPosition();
#endif // CONFIG_SENSORS_VEHICLE_GPS_POSITION
#if defined(CONFIG_SENSORS_VEHICLE_MAGNETOMETER)
InitializeVehicleMagnetometer();
#endif // CONFIG_SENSORS_VEHICLE_MAGNETOMETER
#if defined(CONFIG_SENSORS_VEHICLE_OPTICAL_FLOW)
InitializeVehicleOpticalFlow();
#endif // CONFIG_SENSORS_VEHICLE_OPTICAL_FLOW
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately no, because this block should work in amed_
case and be able to change status of sensors during a fly.
if (_armed) {
return 0;
}
However, I can refactor next logic.
if (!_armed) {
/* All next code */
}
if (_hil_enabled || !_armed) {
#if defined(CONFIG_SENSORS_VEHICLE_GPS_POSITION)
InitializeVehicleGPSPosition();
#endif // CONFIG_SENSORS_VEHICLE_GPS_POSITION
#if defined(CONFIG_SENSORS_VEHICLE_AIR_DATA)
InitializeVehicleAirData();
#endif // CONFIG_SENSORS_VEHICLE_AIR_DATA
#if defined(CONFIG_SENSORS_VEHICLE_MAGNETOMETER)
InitializeVehicleMagnetometer();
#endif // CONFIG_SENSORS_VEHICLE_MAGNETOMETER
if (!_armed) {
#if defined(CONFIG_SENSORS_VEHICLE_OPTICAL_FLOW)
InitializeVehicleOpticalFlow();
#endif // CONFIG_SENSORS_VEHICLE_OPTICAL_FLOW
}
_fakeSensors.update(_failureDetector);
}
3e2eb78
to
1f2a849
Compare
some refactoring:
|
2da5db9
to
5fd2c8c
Compare
…uck) sensor publishers instead of stop / restart
5fd2c8c
to
daa03e3
Compare
src/modules/sensors/failure_detector_HITL/failure_detector_HITL.cpp
Outdated
Show resolved
Hide resolved
src/modules/sensors/failure_detector_HITL/failure_detector_HITL.hpp
Outdated
Show resolved
Hide resolved
I added a few comments, maybe I need to understand the thing better still. Code looks nice and clean, no objections to that. However, I would like to see in the code
|
@Ilia-Loginov , I just add all the hitl mode checks . As we agree now that this failure injection should only run in HITL mode |
Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Component: Introduced failure_detector_hitl module, integrating three classes for handling failure injection messages(FailureDetectorHITL),
simulating sensors that have ceased to update (FakeStuckSensor), and a component managing a collection of these simulated sensors (FakeSensors).
This module is a combination of three classes: FailureDetectorHITL for detecting failure injection messages, FakeStuckSensor for simulating sensors whose readings have become stuck, and FakeSensors, a component that aggregates a collection of such simulated sensors.
Additionally, the handling of the sensors module has been extended to support disabling sensors during flight.
Designed exclusively for operation in HITL (Hardware-In-The-Loop) mode, this module does not interfere with normal operational mode.
Reported-by: Ilia Loginov [email protected]
On branch FEATURE_FAILURE_INJECTION_HITL
Changes to be committed:
modified: src/modules/sensors/CMakeLists.txt
new file: src/modules/sensors/failure_detector_HITL/CMakeLists.txt
new file: src/modules/sensors/failure_detector_HITL/failure_detector_HITL.cpp
new file: src/modules/sensors/failure_detector_HITL/failure_detector_HITL.hpp
modified: src/modules/sensors/sensors.cpp
modified: src/modules/sensors/sensors.hpp
Tested on Pixhawk and Saluki v3 HITL mode