Skip to content

Commit

Permalink
Improvements in Planning interface port to ROS 2 (#86)
Browse files Browse the repository at this point in the history
* Adding node to planning_interface

* moveit_core planning_interface - library as shared

* moveit_core planning_interface - fixing CMakeLists.txt

* clang

* moveit_core planning_interface - update docstrings
  • Loading branch information
ahcorde authored and mlautman committed Jun 1, 2019
1 parent 62ed45b commit f9a1bb5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 5 additions & 1 deletion moveit_core/planning_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(MOVEIT_LIB_NAME moveit_planning_interface)

add_library(${MOVEIT_LIB_NAME}
add_library(${MOVEIT_LIB_NAME} SHARED
src/planning_interface.cpp
src/planning_response.cpp
)
Expand All @@ -13,6 +13,10 @@ ament_target_dependencies(${MOVEIT_LIB_NAME}
urdfdom
urdfdom_headers)

target_link_libraries(${MOVEIT_LIB_NAME}
moveit_robot_trajectory
moveit_robot_state)

install(TARGETS ${MOVEIT_LIB_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,9 @@ class PlannerManager

/// Initialize a planner. This function will be called after the construction of the plugin, before any other call is
/// made.
/// It is assumed that motion plans will be computed for the robot described by \e model and that any exposed ROS
/// functionality
/// or required ROS parameters are namespaced by \e ns
virtual bool initialize(const robot_model::RobotModelConstPtr& model, const std::string& ns);
/// It is assumed that motion plans will be computed for the robot described by \e model
/// and the node is passed as an argument to get some ROS parameters
virtual bool initialize(const robot_model::RobotModelConstPtr& model, std::shared_ptr<rclcpp::Node>& node);

/// Get \brief a short string that identifies the planning interface
virtual std::string getDescription() const;
Expand Down
9 changes: 4 additions & 5 deletions moveit_core/planning_interface/src/planning_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,17 @@ void PlanningContext::setMotionPlanRequest(const MotionPlanRequest& request)
request_ = request;
if (request_.allowed_planning_time <= 0.0)
{
RCLCPP_INFO(LOGGER,
"The timeout for planning must be positive (%lf specified). Assuming one second instead.",
request_.allowed_planning_time);
RCLCPP_INFO(LOGGER, "The timeout for planning must be positive (%lf specified). Assuming one second instead.",
request_.allowed_planning_time);
request_.allowed_planning_time = 1.0;
}
if (request_.num_planning_attempts < 0)
RCLCPP_ERROR(LOGGER, "The number of desired planning attempts should be positive. "
"Assuming one attempt.");
"Assuming one attempt.");
request_.num_planning_attempts = std::max(1, request_.num_planning_attempts);
}

bool PlannerManager::initialize(const robot_model::RobotModelConstPtr& /*unused*/, const std::string& /*unused*/)
bool PlannerManager::initialize(const robot_model::RobotModelConstPtr& /*unused*/, std::shared_ptr<rclcpp::Node>& node)
{
return true;
}
Expand Down

0 comments on commit f9a1bb5

Please sign in to comment.