Skip to content

Commit a00176f

Browse files
committed
Adding dynamic thresholding
1 parent 40683ca commit a00176f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

soccer/src/soccer/planning/planner/rotate_path_planner.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ namespace planning {
1919
using namespace rj_geometry;
2020

2121
Trajectory RotatePathPlanner::plan(const PlanRequest& request) {
22+
if (!cached_angle_change_ && request.trigger_mode == RobotIntent::TriggerMode::AT_END) {
23+
double target_distance =
24+
(request.motion_command.target.position - request.start.pose.position()).mag();
25+
kIsDoneAngleChangeThresh = max(pow(2, -target_distance), 0.01);
26+
}
2227
update_state();
2328
switch (current_state_) {
2429
case PIVOT:

soccer/src/soccer/planning/planner/rotate_path_planner.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ class RotatePathPlanner : public PathPlanner {
4747
enum State { PIVOT, END };
4848
RotatePathPlanner::State current_state_ = RotatePathPlanner::State::PIVOT;
4949

50-
static constexpr double kIsDoneAngleChangeThresh{1.0};
50+
double kIsDoneAngleChangeThresh{1.0};
5151
};
5252
} // namespace planning

0 commit comments

Comments
 (0)