Skip to content

Commit

Permalink
[Add] Use generate parameter library
Browse files Browse the repository at this point in the history
  • Loading branch information
moyashibeans committed Nov 21, 2023
1 parent a262494 commit 5c8090d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
8 changes: 7 additions & 1 deletion local_waypoint_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ find_package(ament_cmake REQUIRED)
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
find_package(Eigen3 REQUIRED)
find_package(generate_parameter_library REQUIRED)


include_directories(
include
${EIGEN3_INCLUDE_DIR}
)

generate_parameter_library(obstracle_waypoint
config/obstracle_waypoint.yaml
)

add_library(local_waypoint_server_component SHARED
src/local_waypoint_server_component.cpp)
target_compile_definitions(local_waypoint_server_component
Expand Down Expand Up @@ -89,4 +95,4 @@ if(BUILD_TESTING)
ament_lint_auto_find_test_dependencies()
endif()

ament_auto_package()
ament_auto_package()
9 changes: 9 additions & 0 deletions local_waypoint_server/config/obstracle_waypoint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
obstracle_waypoint_goals:
obstracle_distance: {
type: double,
default_value: 1.0,
description: "WayPoint and obstacle distance to reject goal_pose and stop in place",
validation: {
bounds<>: [ 0.0, 10.0 ]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ extern "C" {
} // extern "C"
#endif

#include "obstracle_waypoint/obstracle_waypoint.hpp"

#include <quaternion_operation/quaternion_operation.h>
#include <tf2_ros/buffer.h>
#include <tf2_ros/transform_listener.h>
Expand Down Expand Up @@ -118,6 +120,8 @@ class LocalWaypointServerComponent : public rclcpp::Node
boost::optional<double> checkCollisionToCurrentPath();
boost::optional<double> checkCollisionToPath(const hermite_path_msgs::msg::HermitePath & path);
std::vector<geometry_msgs::msg::Pose> getLocalWaypointCandidates(double obstacle_t);
std::shared_ptr<obstracle_waypoint::ParamListener> param_listener_;
obstracle_waypoint::Params obstracle_waypoint_params_;
bool checkObstacleInGoal() const;
bool checkGoalReached() const;
boost::optional<geometry_msgs::msg::Pose> evaluateCandidates(
Expand Down
3 changes: 3 additions & 0 deletions local_waypoint_server/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<test_depend>ament_lint_auto</test_depend>
<test_depend>ouxt_lint_common</test_depend>

<depend>generate_parameter_library</depend>
<depend>parameter_traits</depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
6 changes: 6 additions & 0 deletions local_waypoint_server/src/local_waypoint_server_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ LocalWaypointServerComponent::LocalWaypointServerComponent(const rclcpp::NodeOpt
declare_parameter("goal_reached_threshold", 0.3);
get_parameter("goal_reached_threshold", goal_reached_threshold_);
planner_status_.status = hermite_path_msgs::msg::PlannerStatus::WAITING_FOR_GOAL;
this->param_listener_ = std::make_shared<obstracle_waypoint::ParamListener>(
this->get_node_parameters_interface());
this->params_ = param_listener_->get_params();
/**
* Publishers
*/
Expand Down Expand Up @@ -107,6 +110,9 @@ void LocalWaypointServerComponent::updatePlannerStatus()
}
}
status_pub_->publish(planner_status_);
RCLCPP_INFO_STREAM(
rclcpp::get_logger("dynamixel_hardware_interface"),
"Obstracle waypoint param = " << param_);
}

void LocalWaypointServerComponent::hermitePathCallback(
Expand Down

0 comments on commit 5c8090d

Please sign in to comment.