fix lỗi xoay khi về đích

This commit is contained in:
2026-04-27 14:24:40 +07:00
parent 1a19e38b2d
commit 62a2fed488
3 changed files with 4 additions and 4 deletions

View File

@@ -206,7 +206,7 @@ bool score_algorithm::ScoreAlgorithm::computePlanCommand(const robot_nav_2d_msgs
// Process index_s with multiple elements
if (index_s.size() > 1)
{
for (size_t i = 0; i < index_s.size(); ++i)
for (size_t i = 1; i < index_s.size(); ++i)
{
if (index_s[i - 1] >= (unsigned int)global_plan.poses.size() || index_s[i] >= (unsigned int)global_plan.poses.size())
{

View File

@@ -521,7 +521,7 @@ mkt_msgs::Trajectory2D mkt_algorithm::diff::PredictiveTrajectory::calculator(
const double path_distance_to_rotate = journey(transformed_plan.poses, 0, transformed_plan.poses.size() - 1);
allow_rotate |= path_distance_to_rotate >= distance_allow_rotate;
robot_geometry_msgs::Pose2D back_pose = transformed_plan.poses.back().pose;
allow_rotate |= fabs(atan2(back_pose.y, back_pose.x) - back_pose.theta) > M_PI / 6.0;
allow_rotate |= fabs(atan2(back_pose.y, back_pose.x) - back_pose.theta) > M_PI / 3.0;
allow_rotate &= (fabs(transformed_plan.poses.front().pose.y) <= 0.5);