diff --git a/toid_behaviors/src/move_coords.cpp b/toid_behaviors/src/move_coords.cpp index 2cd985c..d4a5320 100644 --- a/toid_behaviors/src/move_coords.cpp +++ b/toid_behaviors/src/move_coords.cpp @@ -95,10 +95,6 @@ ResultStatus MoveCoords::updateVel( const double current_yaw = tf2::getYaw(pose.orientation); double angle_dist = angles::shortest_angular_distance(current_yaw, target_angle_); - if (backwards_) { - angle_dist = angles::two_pi_complement(angle_dist); - } - const double dx = target_pose_.position.x - pose.position.x; const double dy = target_pose_.position.y - pose.position.y; @@ -120,7 +116,7 @@ ResultStatus MoveCoords::updateVel( if (dist_left <= 0.02) { out_vel.linear.x = std::clamp(target_sign_ * vel, lower_bound, upper_bound); - out_vel.angular.z = std::clamp(target_sign_ * kp_ * angle_dist, -max_angular_speed_, max_angular_speed_); + out_vel.angular.z = std::clamp(kp_ * angle_dist, -max_angular_speed_, max_angular_speed_); last_speed_ = out_vel.linear.x; return ResultStatus{Status::RUNNING}; } diff --git a/toid_bt/behavior_trees/calibration_routines.xml b/toid_bt/behavior_trees/calibration_routines.xml index 2f04d27..35c10c9 100644 --- a/toid_bt/behavior_trees/calibration_routines.xml +++ b/toid_bt/behavior_trees/calibration_routines.xml @@ -1,40 +1,95 @@ - + - - - + + + - + - + + + + + + + + + + + + + + + + + + + + - + - - + + + + + + + + + + + + + + @@ -50,6 +105,9 @@ + Action server name @@ -65,14 +123,20 @@ Action server name - - + - - Action server name + + + Service name + + + Service name diff --git a/toid_bt/behavior_trees/toid_behaviors.btproj b/toid_bt/behavior_trees/toid_behaviors.btproj index 65d9521..52ae4ff 100644 --- a/toid_bt/behavior_trees/toid_behaviors.btproj +++ b/toid_bt/behavior_trees/toid_behaviors.btproj @@ -12,6 +12,7 @@ + Action server name diff --git a/toid_bt/include/toid_bt/plugins/move_coords_action.hpp b/toid_bt/include/toid_bt/plugins/move_coords_action.hpp index 4403516..6e40dd7 100644 --- a/toid_bt/include/toid_bt/plugins/move_coords_action.hpp +++ b/toid_bt/include/toid_bt/plugins/move_coords_action.hpp @@ -28,6 +28,7 @@ public: BT::InputPort("y"), BT::InputPort("theta"), BT::InputPort("max_speed", 0, {}), + BT::InputPort("backwards", false, {}), //BT::InputPort("options"), }); } @@ -38,6 +39,7 @@ public: auto y_goal = getInput("y"); auto theta = getInput("theta"); auto max_speed = getInput("max_speed").value(); + auto backwards = getInput("backwards").value(); goal.x = x_goal.value(); goal.y = y_goal.value(); @@ -50,6 +52,7 @@ public: } goal.max_speed = max_speed; + goal.backwards = backwards; return true; }