Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner_cspace: start planning from expected robot pose #717

Merged
merged 9 commits into from
Sep 14, 2023

Conversation

nhatao
Copy link
Collaborator

@nhatao nhatao commented Sep 5, 2023

Screenshot from 2023-09-14 11-01-45

This PR adds keep_a_part_of_previous_path option. As described in the diagram above, this option is useful when the robot's speed is high or the environment is dynamic.
In addition, the algorithm to preserve paths including switchback points is integrated. When it is expected the robot reaches a switchback point within sw_wait seconds, the path until the switchback point is preserved and the new path planning starts from the switchback point.

@nhatao nhatao marked this pull request as draft September 5, 2023 10:21
@at-wat

This comment has been minimized.

@at-wat

This comment has been minimized.

@at-wat

This comment has been minimized.

@at-wat

This comment has been minimized.

@at-wat

This comment has been minimized.

@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2023

Codecov Report

Merging #717 (ea4bb6a) into master (600e7bb) will increase coverage by 0.06%.
Report is 1 commits behind head on master.
The diff coverage is 91.16%.

@@            Coverage Diff             @@
##           master     #717      +/-   ##
==========================================
+ Coverage   88.34%   88.41%   +0.06%     
==========================================
  Files          60       62       +2     
  Lines        4444     4582     +138     
==========================================
+ Hits         3926     4051     +125     
- Misses        518      531      +13     
Files Changed Coverage Δ
...clude/planner_cspace/planner_3d/grid_astar_model.h 100.00% <ø> (ø)
planner_cspace/src/start_pose_predictor.cpp 87.35% <87.35%> (ø)
planner_cspace/src/planner_3d.cpp 85.47% <92.30%> (+0.21%) ⬆️
...ectory_tracker/include/trajectory_tracker/path2d.h 95.45% <96.87%> (-0.78%) ⬇️
...e/planner_cspace/planner_3d/start_pose_predictor.h 100.00% <100.00%> (ø)
planner_cspace/src/grid_astar_model_3dof.cpp 96.10% <100.00%> (+0.02%) ⬆️

... and 2 files with indirect coverage changes

@at-wat

This comment has been minimized.

@at-wat

This comment has been minimized.

@at-wat

This comment has been minimized.

@nhatao nhatao marked this pull request as ready for review September 14, 2023 02:29
@nhatao nhatao requested a review from at-wat September 14, 2023 02:30
@at-wat

This comment has been minimized.

range_limit,
1.0f / freq_min_,
find_best_))
bool is_goal_same_as_start = false;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems always be false

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, and I added a test to cover this logic.

paths_["switch_back"] = std::make_pair(path_grid_switch_back, getMetricPath(path_grid_switch_back));
}

nav_msgs::Path getMetricPath(const std::list<GridAstar<3, 2>::Vec>& path_grid) const
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like convert rather than get

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 123 to 124
pose.pose.orientation.z = sin(yaw / 2);
pose.pose.orientation.w = cos(yaw / 2);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pose.pose.orientation.z = sin(yaw / 2);
pose.pose.orientation.w = cos(yaw / 2);
pose.pose.orientation.z = std::sin(yaw / 2);
pose.pose.orientation.w = std::cos(yaw / 2);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 169 to 171
EXPECT_EQ(start_grid[0], 5);
EXPECT_EQ(start_grid[1], 6);
EXPECT_EQ(start_grid[2], 1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there's == operator, I think it can be

Suggested change
EXPECT_EQ(start_grid[0], 5);
EXPECT_EQ(start_grid[1], 6);
EXPECT_EQ(start_grid[2], 1);
EXPECT_EQ(StartPosePredictor::Astar::Vec(5, 6, 1), start_grid);

template <typename T2>
bool operator==(const CyclicVecBase<DIM, NONCYCLIC, T2>& v) const
{
for (int i = 0; i < DIM; i++)
if (v.e_[i] != e_[i])
return false;
return true;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@at-wat

This comment has been minimized.

@at-wat

This comment has been minimized.

@nhatao nhatao requested a review from at-wat September 14, 2023 08:18
const std::list<Astar::Vecf> path_interpolated =
model_->path_interpolator_.interpolate(path_grid, 0.5, local_range_);
path.poses = start_pose_predictor_.getPreservedPath().poses;
grid_metric_converter::grid2MetricPath(map_info_, path_interpolated, path);
Copy link
Owner

@at-wat at-wat Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally didn't expect to use grid2MetricPath to append poses to existing path and it looks confusing.
It would be better to rename it to something like grid2MetricPathAppended/grid2MetricPathWithAppend.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to appendGridPath2MetricPath

Copy link
Owner

@at-wat at-wat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@at-wat at-wat enabled auto-merge (squash) September 14, 2023 09:11
@at-wat
Copy link
Owner

at-wat commented Sep 14, 2023

[517] PASSED on noetic

All tests passed
build/test_results/costmap_cspace/gtest-test_costmap_3d.xml: 24 tests
build/test_results/costmap_cspace/gtest-test_pointcloud_accumulator.xml: 4 tests
build/test_results/costmap_cspace/roslint-costmap_cspace.xml: 1 tests
build/test_results/joystick_interrupt/roslint-joystick_interrupt.xml: 1 tests
build/test_results/joystick_interrupt/rostest-test_test_joystick_interrupt_rostest.xml: 1 tests
build/test_results/joystick_interrupt/rosunit-test_joystick_interrupt.xml: 12 tests
build/test_results/map_organizer/roslint-map_organizer.xml: 1 tests
build/test_results/map_organizer/rostest-test_test_map_organizer_rostest.xml: 1 tests
build/test_results/map_organizer/rostest-test_test_pointcloud_to_maps_rostest.xml: 1 tests
build/test_results/map_organizer/rosunit-test_map_organizer.xml: 8 tests
build/test_results/map_organizer/rosunit-test_pointcloud_to_maps.xml: 2 tests
build/test_results/neonavigation_common/roslint-neonavigation_common.xml: 1 tests
build/test_results/neonavigation_common/rostest-test_test_compat_rostest.xml: 1 tests
build/test_results/neonavigation_common/rosunit-test_compat.xml: 6 tests
build/test_results/neonavigation_metrics_msgs/gtest-test_helper.xml: 4 tests
build/test_results/neonavigation_metrics_msgs/roslint-neonavigation_metrics_msgs.xml: 1 tests
build/test_results/obj_to_pointcloud/roslint-obj_to_pointcloud.xml: 1 tests
build/test_results/obj_to_pointcloud/rostest-test_test_obj_to_pointcloud_rostest.xml: 1 tests
build/test_results/obj_to_pointcloud/rosunit-test_obj_to_pointcloud.xml: 2 tests
build/test_results/planner_cspace/gtest-test_blockmem_gridmap.xml: 10 tests
build/test_results/planner_cspace/gtest-test_costmap_bbf.xml: 4 tests
build/test_results/planner_cspace/gtest-test_cyclic_vec.xml: 14 tests
build/test_results/planner_cspace/gtest-test_distance_map.xml: 18 tests
build/test_results/planner_cspace/gtest-test_distance_map_fast_update.xml: 4 tests
build/test_results/planner_cspace/gtest-test_grid_astar.xml: 12 tests
build/test_results/planner_cspace/gtest-test_grid_metric_converter.xml: 4 tests
build/test_results/planner_cspace/gtest-test_motion_cache.xml: 2 tests
build/test_results/planner_cspace/gtest-test_motion_primitive_builder.xml: 2 tests
build/test_results/planner_cspace/gtest-test_path_interpolator.xml: 4 tests
build/test_results/planner_cspace/gtest-test_planner_3d_cost.xml: 2 tests
build/test_results/planner_cspace/gtest-test_start_pose_predictor.xml: 6 tests
build/test_results/planner_cspace/roslint-planner_cspace.xml: 1 tests
build/test_results/planner_cspace/rostest-navigation_rostest__antialias_start_true.xml: 1 tests
build/test_results/planner_cspace/rostest-navigation_rostest__antialias_start_true__fast_map_update_true.xml: 1 tests
build/test_results/planner_cspace/rostest-navigation_rostest__with_tolerance_true.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_abort_rostest.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_costmap_watchdog_rostest.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_debug_outputs_rostest.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_dynamic_parameter_change_rostest.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_navigation_boundary_rostest.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_navigation_compat_rostest.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_navigation_rostest.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_planner_2dof_serial_joints_rostest.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_planner_3d_map_size_rostest.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_preempt_rostest.xml: 1 tests
build/test_results/planner_cspace/rostest-test_test_tolerant_action_rostest.xml: 1 tests
build/test_results/planner_cspace/rosunit-test_abort.xml: 2 tests
build/test_results/planner_cspace/rosunit-test_costmap_watchdog.xml: 4 tests
build/test_results/planner_cspace/rosunit-test_debug_outputs.xml: 8 tests
build/test_results/planner_cspace/rosunit-test_dynamic_parameter_change.xml: 4 tests
build/test_results/planner_cspace/rosunit-test_navigate.xml: 12 tests
build/test_results/planner_cspace/rosunit-test_navigate_boundary.xml: 2 tests
build/test_results/planner_cspace/rosunit-test_planner_2dof_serial_joints.xml: 4 tests
build/test_results/planner_cspace/rosunit-test_planner_3d_map_size.xml: 12 tests
build/test_results/planner_cspace/rosunit-test_preempt.xml: 2 tests
build/test_results/planner_cspace/rosunit-test_tolerant_action.xml: 2 tests
build/test_results/safety_limiter/roslint-safety_limiter.xml: 1 tests
build/test_results/safety_limiter/rostest-test_test_safety_limiter2_rostest.xml: 1 tests
build/test_results/safety_limiter/rostest-test_test_safety_limiter_compat_rostest.xml: 1 tests
build/test_results/safety_limiter/rostest-test_test_safety_limiter_rostest.xml: 1 tests
build/test_results/safety_limiter/rosunit-test_safety_limiter.xml: 22 tests
build/test_results/safety_limiter/rosunit-test_safety_limiter2.xml: 2 tests
build/test_results/track_odometry/gtest-test_tf_projection.xml: 2 tests
build/test_results/track_odometry/roslint-track_odometry.xml: 1 tests
build/test_results/track_odometry/rostest-test_test_tf_projection_rostest.xml: 1 tests
build/test_results/track_odometry/rostest-test_test_track_odometry_rostest.xml: 1 tests
build/test_results/track_odometry/rosunit-test_tf_projection_node.xml: 8 tests
build/test_results/track_odometry/rosunit-test_track_odometry.xml: 10 tests
build/test_results/trajectory_tracker/gtest-test_trajectory_tracker_filter.xml: 6 tests
build/test_results/trajectory_tracker/gtest-test_trajectory_tracker_path2d.xml: 18 tests
build/test_results/trajectory_tracker/roslint-trajectory_tracker.xml: 1 tests
build/test_results/trajectory_tracker/rostest-test_test_trajectory_recorder_rostest.xml: 1 tests
build/test_results/trajectory_tracker/rostest-test_test_trajectory_tracker_overshoot_rostest.xml: 1 tests
build/test_results/trajectory_tracker/rostest-test_test_trajectory_tracker_rostest.xml: 1 tests
build/test_results/trajectory_tracker/rostest-test_test_trajectory_tracker_with_odom_rostest.xml: 1 tests
build/test_results/trajectory_tracker/rostest-trajectory_tracker_rostest__odom_delay_0.xml: 1 tests
build/test_results/trajectory_tracker/rosunit-test_trajectory_recorder.xml: 2 tests
build/test_results/trajectory_tracker/rosunit-test_trajectory_tracker.xml: 16 tests
build/test_results/trajectory_tracker/rosunit-test_trajectory_tracker_overshoot.xml: 12 tests
build/test_results/trajectory_tracker/rosunit-test_trajectory_tracker_with_odom.xml: 4 tests
build/test_results/trajectory_tracker_msgs/gtest-test_path_with_velocity_conversion.xml: 4 tests
build/test_results/trajectory_tracker_msgs/roslint-trajectory_tracker_msgs.xml: 1 tests
Summary: 342 tests, 0 errors, 0 failures, 0 skipped

@at-wat at-wat merged commit 8594cbe into master Sep 14, 2023
3 checks passed
@at-wat at-wat deleted the add-start-pose-predictor branch September 14, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants