@@ -337,33 +337,31 @@ nav_msgs::msg::Path SmacPlannerHybrid::createPlan(
337337 std::to_string (start.pose .position .y ) + " ) was outside bounds" );
338338 }
339339
340- double orientation_bin = tf2::getYaw (start.pose .orientation ) / _angle_bin_size;
340+ double orientation_bin = std::round ( tf2::getYaw (start.pose .orientation ) / _angle_bin_size) ;
341341 while (orientation_bin < 0.0 ) {
342342 orientation_bin += static_cast <float >(_angle_quantizations);
343343 }
344344 // This is needed to handle precision issues
345345 if (orientation_bin >= static_cast <float >(_angle_quantizations)) {
346346 orientation_bin -= static_cast <float >(_angle_quantizations);
347347 }
348- unsigned int orientation_bin_id = static_cast <unsigned int >(floor (orientation_bin));
349- _a_star->setStart (mx, my, orientation_bin_id);
348+ _a_star->setStart (mx, my, static_cast <unsigned int >(orientation_bin));
350349
351350 // Set goal point, in A* bin search coordinates
352351 if (!costmap->worldToMap (goal.pose .position .x , goal.pose .position .y , mx, my)) {
353352 throw nav2_core::GoalOutsideMapBounds (
354353 " Goal Coordinates of(" + std::to_string (goal.pose .position .x ) + " , " +
355354 std::to_string (goal.pose .position .y ) + " ) was outside bounds" );
356355 }
357- orientation_bin = tf2::getYaw (goal.pose .orientation ) / _angle_bin_size;
356+ orientation_bin = std::round ( tf2::getYaw (goal.pose .orientation ) / _angle_bin_size) ;
358357 while (orientation_bin < 0.0 ) {
359358 orientation_bin += static_cast <float >(_angle_quantizations);
360359 }
361360 // This is needed to handle precision issues
362361 if (orientation_bin >= static_cast <float >(_angle_quantizations)) {
363362 orientation_bin -= static_cast <float >(_angle_quantizations);
364363 }
365- orientation_bin_id = static_cast <unsigned int >(floor (orientation_bin));
366- _a_star->setGoal (mx, my, orientation_bin_id);
364+ _a_star->setGoal (mx, my, static_cast <unsigned int >(orientation_bin));
367365
368366 // Setup message
369367 nav_msgs::msg::Path plan;
0 commit comments