Skip to content

Commit

Permalink
Merge pull request #1310 from mavlink/gimbal-v2
Browse files Browse the repository at this point in the history
Gimbal v2: implement take_control and release_control
  • Loading branch information
julianoes authored Feb 4, 2021
2 parents 3aa3b35 + a57bf74 commit 14c5154
Show file tree
Hide file tree
Showing 16 changed files with 4,969 additions and 384 deletions.
2 changes: 1 addition & 1 deletion proto
12 changes: 12 additions & 0 deletions src/integration_tests/gimbal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ TEST(SitlTestGimbal, GimbalMove)

telemetry->subscribe_camera_attitude_euler(&receive_gimbal_attitude_euler_angles);

EXPECT_EQ(gimbal->take_control(Gimbal::ControlMode::Primary), Gimbal::Result::Success);

EXPECT_EQ(gimbal->set_mode(Gimbal::GimbalMode::YawFollow), Gimbal::Result::Success);

LogInfo() << "Pitch down for a bit";
Expand All @@ -66,6 +68,8 @@ TEST(SitlTestGimbal, GimbalMove)
EXPECT_EQ(gimbal->set_pitch_and_yaw(0.0f, 0.0f), Gimbal::Result::Success);

std::this_thread::sleep_for(std::chrono::seconds(1));

EXPECT_EQ(gimbal->take_control(Gimbal::ControlMode::None), Gimbal::Result::Success);
}

TEST(SitlTestGimbal, GimbalAngles)
Expand All @@ -87,6 +91,8 @@ TEST(SitlTestGimbal, GimbalAngles)

auto gimbal = std::make_shared<Gimbal>(system);

EXPECT_EQ(gimbal->take_control(Gimbal::ControlMode::Primary), Gimbal::Result::Success);

EXPECT_EQ(gimbal->set_mode(Gimbal::GimbalMode::YawFollow), Gimbal::Result::Success);

LogInfo() << "Pitch 45 degrees down";
Expand Down Expand Up @@ -114,6 +120,8 @@ TEST(SitlTestGimbal, GimbalAngles)
LogInfo() << "Yaw forward";
EXPECT_EQ(gimbal->set_pitch_and_yaw(0.0f, 0.0f), Gimbal::Result::Success);
std::this_thread::sleep_for(std::chrono::seconds(1));

EXPECT_EQ(gimbal->take_control(Gimbal::ControlMode::None), Gimbal::Result::Success);
}

TEST(SitlTestGimbal, GimbalTakeoffAndMove)
Expand Down Expand Up @@ -164,6 +172,8 @@ TEST(SitlTestGimbal, GimbalTakeoffAndMove)

std::this_thread::sleep_for(std::chrono::seconds(1));

EXPECT_EQ(gimbal->take_control(Gimbal::ControlMode::Primary), Gimbal::Result::Success);

// First use gimbal in yaw follow mode.
EXPECT_EQ(gimbal->set_mode(Gimbal::GimbalMode::YawFollow), Gimbal::Result::Success);

Expand All @@ -176,6 +186,8 @@ TEST(SitlTestGimbal, GimbalTakeoffAndMove)
gimbal_pattern(gimbal);
std::this_thread::sleep_for(std::chrono::seconds(1));

EXPECT_EQ(gimbal->take_control(Gimbal::ControlMode::None), Gimbal::Result::Success);

action->land();
std::this_thread::sleep_for(std::chrono::seconds(3));
}
Expand Down
119 changes: 119 additions & 0 deletions src/mavsdk_server/src/generated/gimbal/gimbal.grpc.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 14c5154

Please sign in to comment.