Skip to content
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

Added motion duration to the 'move to pose' service of the camera tracking plugin. #594

Merged
merged 3 commits into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/plugins/camera_tracking/CameraTracking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ class CameraTracking::Implementation
/// \brief The pose set from the move to pose service.
public: std::optional<math::Pose3d> moveToPoseValue;

/// \brief The motion duration set from the move to pose service.
public: std::optional<double> moveToPoseDuration;

/// \brief Follow service
public: std::string followService;

Expand Down Expand Up @@ -250,6 +253,7 @@ void CameraTracking::Implementation::OnMoveToComplete()
void CameraTracking::Implementation::OnMoveToPoseComplete()
{
this->moveToPoseValue.reset();
this->moveToPoseDuration.reset();
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -290,6 +294,15 @@ bool CameraTracking::Implementation::OnMoveToPose(const msgs::GUICamera &_msg,

this->moveToPoseValue = pose;

if (_msg.duration() > 0)
{
this->moveToPoseDuration = _msg.duration();
}
else
{
this->moveToPoseDuration = 0.5;
}

_res.set_data(true);
return true;
}
Expand Down Expand Up @@ -352,7 +365,8 @@ void CameraTracking::Implementation::OnRender()
{
this->moveToHelper.MoveTo(this->camera,
*(this->moveToPoseValue),
0.5, std::bind(&Implementation::OnMoveToPoseComplete, this));
*(this->moveToPoseDuration),
std::bind(&Implementation::OnMoveToPoseComplete, this));
this->prevMoveToTime = std::chrono::system_clock::now();
}
else
Expand Down