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) {
23 std::string error_msg =
"Backing up in Y and Z not supported, will only move in X.";
24 RCLCPP_INFO(logger_, error_msg.c_str());
25 return ResultStatus{Status::FAILED, BackUpActionResult::INVALID_INPUT, error_msg};
29 command_x_ = -std::fabs(command->target.x);
30 command_speed_ = -std::fabs(command->speed);
31 command_time_allowance_ = command->time_allowance;
32 command_disable_collision_checks_ = command->disable_collision_checks;
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 std::string error_msg =
"Initial robot pose is not available.";
41 RCLCPP_ERROR(logger_, error_msg.c_str());
42 return ResultStatus{Status::FAILED, BackUpActionResult::TF_ERROR, error_msg};
45 return ResultStatus{Status::SUCCEEDED, BackUpActionResult::NONE,
""};
50 #include "pluginlib/class_list_macros.hpp"
Abstract interface for behaviors to adhere to with pluginlib.