mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 15:13:33 +08:00
Commander: separate out arm state machine to class
Pure refactoring and just the first step to avoid conflicts on the way.
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "../state_machine_helper.h"
|
||||
#include <unit_test.h>
|
||||
#include "../Arming/ArmStateMachine/ArmStateMachine.hpp"
|
||||
#include "../Arming/PreFlightCheck/PreFlightCheck.hpp"
|
||||
|
||||
class StateMachineHelperTest : public UnitTest
|
||||
@@ -50,6 +51,8 @@ public:
|
||||
StateMachineHelperTest() = default;
|
||||
~StateMachineHelperTest() override = default;
|
||||
|
||||
ArmStateMachine _arm_state_machine{};
|
||||
|
||||
bool run_tests() override;
|
||||
|
||||
private:
|
||||
@@ -303,13 +306,18 @@ bool StateMachineHelperTest::armingStateTransitionTest()
|
||||
vehicle_control_mode_s control_mode{};
|
||||
|
||||
// Attempt transition
|
||||
transition_result_t result = arming_state_transition(status, control_mode, safety, test->requested_state, armed,
|
||||
true /* enable pre-arm checks */,
|
||||
nullptr /* no mavlink_log_pub */,
|
||||
status_flags,
|
||||
arm_req,
|
||||
2e6, /* 2 seconds after boot, everything should be checked */
|
||||
arm_disarm_reason_t::unit_test);
|
||||
transition_result_t result = _arm_state_machine.arming_state_transition(
|
||||
status,
|
||||
control_mode,
|
||||
safety,
|
||||
test->requested_state,
|
||||
armed,
|
||||
true /* enable pre-arm checks */,
|
||||
nullptr /* no mavlink_log_pub */,
|
||||
status_flags,
|
||||
arm_req,
|
||||
2e6, /* 2 seconds after boot, everything should be checked */
|
||||
arm_disarm_reason_t::unit_test);
|
||||
|
||||
// Validate result of transition
|
||||
ut_compare(test->assertMsg, test->expected_transition_result, result);
|
||||
|
||||
Reference in New Issue
Block a user