Skip to content

Commit

Permalink
Correction of initial rotation
Browse files Browse the repository at this point in the history
Signed-off-by: Jakubach <[email protected]>
  • Loading branch information
Jakubach committed Nov 14, 2024
1 parent 8414e09 commit 3cb522f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nav2_docking/opennav_docking/src/docking_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ bool DockingServer::approachDock(Dock * dock, geometry_msgs::msg::PoseStamped &
target_pose.header.stamp = rclcpp::Time(0);

const double backward_projection = 0.25;
const double yaw = tf2::getYaw(target_pose.pose.orientation);
double yaw = tf2::getYaw(target_pose.pose.orientation);

// The control law can get jittery when close to the end when atan2's can explode.
// Thus, we backward project the controller's target pose a little bit after the
Expand All @@ -472,6 +472,7 @@ bool DockingServer::approachDock(Dock * dock, geometry_msgs::msg::PoseStamped &
// This is to ensure that the robot doesn't try to dock from the wrong side
target_pose.pose.orientation = nav2_util::geometry_utils::orientationAroundZAxis(
yaw + M_PI);
yaw = tf2::getYaw(target_pose.pose.orientation);
target_pose.pose.position.x -= cos(yaw) * backward_projection;
target_pose.pose.position.y -= sin(yaw) * backward_projection;
} else {
Expand Down

0 comments on commit 3cb522f

Please sign in to comment.