Skip to content

Commit

Permalink
Add count methods
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Nov 21, 2023
1 parent bbc07ce commit b705556
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
16 changes: 16 additions & 0 deletions nexus_motion_planner/src/motion_plan_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,22 @@ bool MotionPlanCache::init(
return db_->connect();
}

unsigned
MotionPlanCache::count_plans(const std::string& move_group_namespace)
{
auto coll = db_->openCollection<moveit_msgs::msg::RobotTrajectory>(
"move_group_plan_cache", move_group_namespace);
return coll.count();
}

unsigned
MotionPlanCache::count_cartesian_plans(const std::string& move_group_namespace)
{
auto coll = db_->openCollection<moveit_msgs::msg::RobotTrajectory>(
"move_group_cartesian_plan_cache", move_group_namespace);
return coll.count();
}

// =============================================================================
// MOTION PLAN CACHING
// =============================================================================
Expand Down
7 changes: 4 additions & 3 deletions nexus_motion_planner/src/motion_plan_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit_msgs/srv/get_cartesian_path.hpp>

// NEXUS messages
#include <nexus_endpoints.hpp>

namespace nexus {
namespace motion_planner {

Expand Down Expand Up @@ -93,6 +90,10 @@ class MotionPlanCache
uint32_t db_port = 0,
double exact_match_precision = 1e-6);

unsigned count_plans(const std::string& move_group_namespace);

unsigned count_cartesian_plans(const std::string& move_group_namespace);

// ===========================================================================
// MOTION PLAN CACHING
// ===========================================================================
Expand Down

0 comments on commit b705556

Please sign in to comment.