Skip to content

Commit

Permalink
Test half in-tolerance
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Nov 26, 2023
1 parent e23f202 commit a235d20
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions nexus_motion_planner/src/test_motion_plan_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,38 @@ void test_motion_plans(
check_and_emit(
fetched_plan == nullptr, prefix, "Fetch best plan is nullptr");

// Fetch non-matching, only start in tolerance (but not goal)
//
// Non-matching key should not have cache hit
prefix =
"test_motion_plans.put_first.fetch_non_matching_only_start_in_tolerance";

fetched_plans = cache->fetch_all_matching_plans(
*move_group, g_robot_name, close_matching_plan_req, 999, 0);

fetched_plan = cache->fetch_best_matching_plan(
*move_group, g_robot_name, close_matching_plan_req, 999, 0);

check_and_emit(fetched_plans.size() == 0, prefix, "Fetch all returns empty");
check_and_emit(
fetched_plan == nullptr, prefix, "Fetch best plan is nullptr");

// Fetch non-matching, only goal in tolerance (but not start)
//
// Non-matching key should not have cache hit
prefix =
"test_motion_plans.put_first.fetch_non_matching_only_goal_in_tolerance";

fetched_plans = cache->fetch_all_matching_plans(
*move_group, g_robot_name, close_matching_plan_req, 0, 999);

fetched_plan = cache->fetch_best_matching_plan(
*move_group, g_robot_name, close_matching_plan_req, 0, 999);

check_and_emit(fetched_plans.size() == 0, prefix, "Fetch all returns empty");
check_and_emit(
fetched_plan == nullptr, prefix, "Fetch best plan is nullptr");

// Fetch non-matching, in tolerance
//
// Close key within tolerance limit should have cache hit
Expand Down Expand Up @@ -856,6 +888,42 @@ void test_cartesian_plans(
check_and_emit(
fetched_plan == nullptr, prefix, "Fetch best plan is nullptr");

// Fetch non-matching, only start in tolerance (but not goal)
//
// Non-matching key should not have cache hit
prefix =
"test_motion_plans.put_first.fetch_non_matching_only_start_in_tolerance";

fetched_plans = cache->fetch_all_matching_cartesian_plans(
*move_group, g_robot_name, close_matching_cartesian_plan_req,
fraction, 999, 0);

fetched_plan = cache->fetch_best_matching_cartesian_plan(
*move_group, g_robot_name, close_matching_cartesian_plan_req,
fraction, 999, 0);

check_and_emit(fetched_plans.size() == 0, prefix, "Fetch all returns empty");
check_and_emit(
fetched_plan == nullptr, prefix, "Fetch best plan is nullptr");

// Fetch non-matching, only goal in tolerance (but not start)
//
// Non-matching key should not have cache hit
prefix =
"test_motion_plans.put_first.fetch_non_matching_only_goal_in_tolerance";

fetched_plans = cache->fetch_all_matching_cartesian_plans(
*move_group, g_robot_name, close_matching_cartesian_plan_req,
fraction, 0, 999);

fetched_plan = cache->fetch_best_matching_cartesian_plan(
*move_group, g_robot_name, close_matching_cartesian_plan_req,
fraction, 0, 999);

check_and_emit(fetched_plans.size() == 0, prefix, "Fetch all returns empty");
check_and_emit(
fetched_plan == nullptr, prefix, "Fetch best plan is nullptr");

// Fetch non-matching, in tolerance
//
// Close key within tolerance limit should have cache hit
Expand Down

0 comments on commit a235d20

Please sign in to comment.