15 #include "nav2_behaviors/plugins/back_up.hpp"
17 namespace nav2_behaviors
20 ResultStatus BackUp::onRun(
const std::shared_ptr<const BackUpAction::Goal> command)
22 if (command->target.y != 0.0 || command->target.z != 0.0) {
25 "Backing up in Y and Z not supported, will only move in X.");
26 return ResultStatus{Status::FAILED, BackUpActionResult::INVALID_INPUT};
30 command_x_ = -std::fabs(command->target.x);
31 command_speed_ = -std::fabs(command->speed);
32 command_time_allowance_ = command->time_allowance;
34 end_time_ = this->clock_->now() + command_time_allowance_;
36 if (!nav2_util::getCurrentPose(
37 initial_pose_, *tf_, local_frame_, robot_base_frame_,
38 transform_tolerance_))
40 RCLCPP_ERROR(logger_,
"Initial robot pose is not available.");
41 return ResultStatus{Status::FAILED, BackUpActionResult::TF_ERROR};
44 return ResultStatus{Status::SUCCEEDED, BackUpActionResult::NONE};
49 #include "pluginlib/class_list_macros.hpp"
Abstract interface for behaviors to adhere to with pluginlib.