22#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
23#include <geometry_msgs/msg/quaternion_stamped.hpp>
38 RCLCPP_ERROR(
getLogger(),
"[CbNavigateBackwards] distance must be greater or equal than 0");
39 this->backwardDistance = 0;
50 getLogger(),
"[CbNavigateBackwards] Straight backwards motion distance: " << dist);
54 auto currentPoseMsg = p->toPoseMsg();
55 tf2::Transform currentPose;
56 tf2::fromMsg(currentPoseMsg, currentPose);
58 tf2::Transform backwardDeltaTransform;
59 backwardDeltaTransform.setIdentity();
60 backwardDeltaTransform.setOrigin(tf2::Vector3(-dist, 0, 0));
62 tf2::Transform targetPose = currentPose * backwardDeltaTransform;
65 goal.pose.header.frame_id = referenceFrame;
67 tf2::toMsg(targetPose, goal.pose.pose);
68 RCLCPP_INFO_STREAM(
getLogger(),
"[CbNavigateBackwards] TARGET POSE BACKWARDS: " << goal.pose);
70 geometry_msgs::msg::PoseStamped currentStampedPoseMsg;
71 currentStampedPoseMsg.header.frame_id = referenceFrame;
72 currentStampedPoseMsg.header.stamp =
getNode()->now();
73 tf2::toMsg(currentPose, currentStampedPoseMsg.pose);
void sendGoal(ClNav2Z::Goal &goal)
cl_nav2z::ClNav2Z * nav2zClient_
cl_nav2z::odom_tracker::OdomTracker * odomTracker_
CbNavigateBackwards(float backwardDistanceMeters)
void setGoalCheckerId(std::string goal_checker_id)
void setBackwardPlanner(bool commit=true)
const std::string & getReferenceFrame() const
void setWorkingMode(WorkingMode workingMode)
void setStartPoint(const geometry_msgs::msg::PoseStamped &pose)
virtual rclcpp::Logger getLogger() const
virtual rclcpp::Node::SharedPtr getNode() const
TComponent * getComponent()
typename ActionClient::Goal Goal