Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions soccer/src/soccer/planning/planner/rotate_path_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
using namespace rj_geometry;

Trajectory RotatePathPlanner::plan(const PlanRequest& request) {
if (!cached_angle_change_ && request.trigger_mode == RobotIntent::TriggerMode::AT_END) {
double target_distance =
(request.motion_command.target.position - request.start.pose.position()).mag();
isDoneAngleChangeThresh = max(pow(2, -target_distance), 0.01);
}
update_state();
switch (current_state_) {
case PIVOT:
Expand All @@ -35,7 +40,7 @@
return;
}
current_state_ = abs(cached_angle_change_.value()) <
degrees_to_radians(static_cast<float>(kIsDoneAngleChangeThresh))
degrees_to_radians(static_cast<float>(isDoneAngleChangeThresh))
? END
: PIVOT;
}
Expand Down Expand Up @@ -70,7 +75,7 @@
Trajectory path{};

if (cached_target_angle_.has_value() &&
(*cached_target_angle_ - target_angle) < degrees_to_radians(kIsDoneAngleChangeThresh)) {
(*cached_target_angle_ - target_angle) < degrees_to_radians(isDoneAngleChangeThresh)) {

Check warning on line 78 in soccer/src/soccer/planning/planner/rotate_path_planner.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

narrowing conversion from 'double' to 'float'
if (cached_path_) {
path = cached_path_.value();
} else {
Expand Down
2 changes: 1 addition & 1 deletion soccer/src/soccer/planning/planner/rotate_path_planner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
enum State { PIVOT, END };
RotatePathPlanner::State current_state_ = RotatePathPlanner::State::PIVOT;

static constexpr double kIsDoneAngleChangeThresh{1.0};
double isDoneAngleChangeThresh{1.0};

Check warning on line 50 in soccer/src/soccer/planning/planner/rotate_path_planner.hpp

View workflow job for this annotation

GitHub Actions / build-and-test

invalid case style for private member 'isDoneAngleChangeThresh'
};
} // namespace planning
Loading