mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 04:43:34 +08:00
mavsdk_tests: init RC with throttle centered
This commit is contained in:
@@ -445,12 +445,14 @@ void AutopilotTester::check_mission_item_speed_above(int item_index, float min_s
|
|||||||
|
|
||||||
void AutopilotTester::fly_forward_in_posctl()
|
void AutopilotTester::fly_forward_in_posctl()
|
||||||
{
|
{
|
||||||
// Send something to make sure RC is available.
|
|
||||||
CHECK(_manual_control->set_manual_control_input(0.f, 0.f, 0.f, 0.f) == ManualControl::Result::Success);
|
|
||||||
CHECK(_manual_control->start_position_control() == ManualControl::Result::Success);
|
|
||||||
|
|
||||||
const unsigned manual_control_rate_hz = 50;
|
const unsigned manual_control_rate_hz = 50;
|
||||||
|
|
||||||
|
// Send something to make sure RC is available.
|
||||||
|
for (unsigned i = 0; i < 5 * manual_control_rate_hz; ++i) {
|
||||||
|
CHECK(_manual_control->set_manual_control_input(0.f, 0.f, 0.5f, 0.f) == ManualControl::Result::Success);
|
||||||
|
std::this_thread::sleep_for(adjust_to_lockstep_speed(std::chrono::milliseconds(1000 / manual_control_rate_hz)));
|
||||||
|
}
|
||||||
|
|
||||||
// Climb up for 5 seconds
|
// Climb up for 5 seconds
|
||||||
for (unsigned i = 0; i < 5 * manual_control_rate_hz; ++i) {
|
for (unsigned i = 0; i < 5 * manual_control_rate_hz; ++i) {
|
||||||
CHECK(_manual_control->set_manual_control_input(0.f, 0.f, 1.f, 0.f) == ManualControl::Result::Success);
|
CHECK(_manual_control->set_manual_control_input(0.f, 0.f, 1.f, 0.f) == ManualControl::Result::Success);
|
||||||
@@ -476,12 +478,16 @@ void AutopilotTester::fly_forward_in_posctl()
|
|||||||
|
|
||||||
void AutopilotTester::fly_forward_in_altctl()
|
void AutopilotTester::fly_forward_in_altctl()
|
||||||
{
|
{
|
||||||
// Send something to make sure RC is available.
|
|
||||||
CHECK(_manual_control->set_manual_control_input(0.f, 0.f, 0.f, 0.f) == ManualControl::Result::Success);
|
|
||||||
CHECK(_manual_control->start_altitude_control() == ManualControl::Result::Success);
|
|
||||||
|
|
||||||
const unsigned manual_control_rate_hz = 50;
|
const unsigned manual_control_rate_hz = 50;
|
||||||
|
|
||||||
|
// Send something to make sure RC is available.
|
||||||
|
for (unsigned i = 0; i < 5 * manual_control_rate_hz; ++i) {
|
||||||
|
CHECK(_manual_control->set_manual_control_input(0.f, 0.f, 0.5f, 0.f) == ManualControl::Result::Success);
|
||||||
|
std::this_thread::sleep_for(adjust_to_lockstep_speed(std::chrono::milliseconds(1000 / manual_control_rate_hz)));
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK(_manual_control->start_altitude_control() == ManualControl::Result::Success);
|
||||||
|
|
||||||
// Climb up for 5 seconds
|
// Climb up for 5 seconds
|
||||||
for (unsigned i = 0; i < 5 * manual_control_rate_hz; ++i) {
|
for (unsigned i = 0; i < 5 * manual_control_rate_hz; ++i) {
|
||||||
CHECK(_manual_control->set_manual_control_input(0.f, 0.f, 1.f, 0.f) == ManualControl::Result::Success);
|
CHECK(_manual_control->set_manual_control_input(0.f, 0.f, 1.f, 0.f) == ManualControl::Result::Success);
|
||||||
|
|||||||
Reference in New Issue
Block a user