File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
include/nav2_behaviors/plugins Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ class Wait : public TimedBehavior<WaitAction>
6363 CostmapInfoType getResourceInfo () override {return CostmapInfoType::LOCAL;}
6464
6565protected:
66- std::chrono::time_point<std::chrono::steady_clock> wait_end_;
66+ rclcpp::Time wait_end_;
6767 WaitAction::Feedback::SharedPtr feedback_;
6868};
6969
Original file line number Diff line number Diff line change @@ -30,21 +30,19 @@ Wait::~Wait() = default;
3030
3131ResultStatus Wait::onRun (const std::shared_ptr<const WaitAction::Goal> command)
3232{
33- wait_end_ = std::chrono::steady_clock::now () +
34- rclcpp::Duration (command->time ).to_chrono <std::chrono::nanoseconds>();
33+ wait_end_ = node_.lock ()->now () + rclcpp::Duration (command->time );
3534 return ResultStatus{Status::SUCCEEDED};
3635}
3736
3837ResultStatus Wait::onCycleUpdate ()
3938{
40- auto current_point = std::chrono::steady_clock::now ();
41- auto time_left =
42- std::chrono::duration_cast<std::chrono::nanoseconds>(wait_end_ - current_point).count ();
39+ auto current_point = node_.lock ()->now ();
40+ auto time_left = wait_end_ - current_point;
4341
44- feedback_->time_left = rclcpp::Duration ( rclcpp::Duration::from_nanoseconds ( time_left)) ;
42+ feedback_->time_left = time_left;
4543 action_server_->publish_feedback (feedback_);
4644
47- if (time_left > 0 ) {
45+ if (time_left. nanoseconds () > 0 ) {
4846 return ResultStatus{Status::RUNNING};
4947 } else {
5048 return ResultStatus{Status::SUCCEEDED};
You can’t perform that action at this time.
0 commit comments