Skip to content

Commit

Permalink
Added motion duration to the 'move to pose' service of the camera tra…
Browse files Browse the repository at this point in the history
…cking plugin. (#594)

Signed-off-by: Johan Rutgeerts <[email protected]>
  • Loading branch information
jrutgeer authored Dec 1, 2023
1 parent 352e726 commit 91b50b8
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit 91b50b8

Please sign in to comment.