Skip to content

Commit

Permalink
Merge pull request #20 from ichiro-its/hotfix/fix-direction-in-locomo…
Browse files Browse the repository at this point in the history
…tion

[Hotfix] - Fix direction in move_backward_to and move_forward_to
  • Loading branch information
hiikariri authored Jun 10, 2024
2 parents d51de45 + fa81832 commit 0fdd89f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/suiryoku/locomotion/process/locomotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ bool Locomotion::move_backward_to(const keisan::Point2 & target)
return true;
}

auto direction = keisan::make_degree(atan2(delta_x, delta_y)).normalize() + 180.0_deg;
auto direction = keisan::signed_arctan(delta_y, delta_x) + 180.0_deg;
auto delta_direction = (direction - robot->orientation).normalize().degree();

double x_speed = keisan::map(std::abs(delta_direction), 0.0, 15.0, backward_max_x, backward_min_x);
Expand Down Expand Up @@ -332,9 +332,9 @@ bool Locomotion::move_forward_to(const keisan::Point2 & target)
if (target_distance < 8.0) {
return true;
}

auto direction = keisan::make_degree(atan2(delta_x, delta_y)).normalize();
auto delta_direction = (direction - robot->orientation).normalize().degree();
auto direction = keisan::signed_arctan(delta_y, delta_x);
double delta_direction = (direction - robot->orientation).normalize().degree();

double x_speed = keisan::map(std::abs(delta_direction), 0.0, 15.0, move_max_x, move_min_x);
if (target_distance < 100.0) {
Expand Down

0 comments on commit 0fdd89f

Please sign in to comment.