Skip to content

Dock target pose offset sign #47

Closed
@redvinaa

Description

@redvinaa

I noticed that when docking backwards (the plug is on the back of the robot, with the detected maker pose of the docking station pointing forward towards the robot), the target pose offset is applied in the wrong direction. Here is the change that solves it for me, but I'm not sure if it's a real bug or a problem with my setup.

diff --git a/opennav_docking/src/docking_server.cpp b/opennav_docking/src/docking_server.cpp
index 75d428e..6146d25 100644
--- a/opennav_docking/src/docking_server.cpp
+++ b/opennav_docking/src/docking_server.cpp
@@ -412,7 +412,8 @@ bool DockingServer::approachDock(Dock * dock, geometry_msgs::msg::PoseStamped &
     // Thus, we backward project the controller's target pose a little bit after the
     // dock so that the robot never gets to the end of the spiral before its in contact
     // with the dock to stop the docking procedure.
-    const double backward_projection = 0.25;
+    float sign = dock_backwards_ ? -1.0 : 1.0;
+    const double backward_projection = 0.25 * sign;
     const double 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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions