Skip to content

Commit 0b575bf

Browse files
committed
cx_features: add generated features for navgraph interface communication
1 parent 627a815 commit 0b575bf

File tree

11 files changed

+1111
-1
lines changed

11 files changed

+1111
-1
lines changed

cx_bringup/params/clips_features_manager.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
clips_features_manager:
22
ros__parameters:
3-
clips_features_list: ["clips_pddl_parser", "skill_execution", "clips_protobuf", "ros_topic_publisher", "ros_topic_subscriber", "ros_service_requester"]
3+
clips_features_list: ["clips_pddl_parser", "skill_execution", "clips_protobuf", "ros_topic_publisher", "ros_topic_subscriber", "ros_service_requester", "navgraph_compute", "navgraph_set_bounding_box"]
44
clips_features:
55
mock_feature:
66
plugin: "cx::MockFeature"
@@ -16,6 +16,14 @@ clips_features_manager:
1616
plugin: "cx::RosTopicSubscriberFeature"
1717
ros_service_requester:
1818
plugin: "cx::RosServiceRequesterFeature"
19+
navgraph_compute:
20+
plugin: "cx:NavGraphCompute"
21+
navgraph_set_bounding_box:
22+
plugin: "cx:NavGraphSetBoundingBox"
23+
navgraph_set_bounding_box:
24+
plugin: "cx:NavGraphGenerateWaitzones"
25+
navgraph_set_bounding_box:
26+
plugin: "cx:NavGraphUpdateStationByTag"
1927
clips_protobuf:
2028
plugin: "cx::ClipsProtobufFeature"
2129
feature_parameters: ["protobuf_path"]

cx_features/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,22 @@ add_library(ros_topic_subscriber_feature SHARED src/cx_features/ros_communicatio
9595
ament_target_dependencies(ros_topic_subscriber_feature ${dependencies})
9696
target_link_libraries(ros_topic_subscriber_feature PkgConfig::CLIPSMM)
9797

98+
add_library(navgraph_compute SHARED src/cx_features/ros_communication_feature/NavGraphCompute.cpp)
99+
ament_target_dependencies(navgraph_compute ${dependencies})
100+
target_link_libraries(navgraph_compute PkgConfig::CLIPSMM)
101+
102+
add_library(navgraph_set_bounding_box SHARED src/cx_features/ros_communication_feature/NavGraphSetBoundingBox.cpp)
103+
ament_target_dependencies(navgraph_set_bounding_box ${dependencies})
104+
target_link_libraries(navgraph_set_bounding_box PkgConfig::CLIPSMM)
105+
106+
add_library(navgraph_generate_waitzones SHARED src/cx_features/ros_communication_feature/NavGraphGenerateWaitzones.cpp)
107+
ament_target_dependencies(navgraph_generate_waitzones ${dependencies})
108+
target_link_libraries(navgraph_generate_waitzones PkgConfig::CLIPSMM)
109+
110+
add_library(navgraph_update_station_by_tag SHARED src/cx_features/ros_communication_feature/NavGraphUpdateStationByTag.cpp)
111+
ament_target_dependencies(navgraph_update_station_by_tag ${dependencies})
112+
target_link_libraries(navgraph_update_station_by_tag PkgConfig::CLIPSMM)
113+
98114

99115
# END OF PLUGINS REGISTRATION
100116
add_library(${PROJECT_NAME} SHARED ${CX_FEATURES_SOURCES})
@@ -128,6 +144,10 @@ install(TARGETS
128144
ros_service_requester_feature
129145
ros_topic_subscriber_feature
130146
ros_topic_publisher_feature
147+
navgraph_compute
148+
navgraph_set_bounding_box
149+
navgraph_generate_waitzones
150+
navgraph_update_station_by_tag
131151
clips_pddl_parser_feature
132152
clips_protobuf_feature
133153
${PROJECT_NAME}

cx_features/features_plugin.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,24 @@
3939
<description>Clips Feature providing Protobuf-based communication</description>
4040
</class>
4141
</library>
42+
<library path="navgraph_compute">
43+
<class type="cx::NavGraphCompute" base_class_type="cx::ClipsFeature">
44+
<description>Clips Feature providing access to NavGraphInterfaceCompute ROS2 services</description>
45+
</class>
46+
</library>
47+
<library path="navgraph_set_boundingBox">
48+
<class type="cx::NavGraphSetBoundingBox" base_class_type="cx::ClipsFeature">
49+
<description>Clips Feature providing access to NavGraphInterfaceSetBoundingBox ROS2 services</description>
50+
</class>
51+
</library>
52+
<library path="navgraph_generate_waitzones">
53+
<class type="cx::NavGraphGenerateWaitzones" base_class_type="cx::ClipsFeature">
54+
<description>Clips Feature providing access to NavGraphInterfaceGenerateWaitzones ROS2 services</description>
55+
</class>
56+
</library>
57+
<library path="navgraph_update_station_by_tag">
58+
<class type="cx::NavGraphUpdateStationByTag" base_class_type="cx::ClipsFeature">
59+
<description>Clips Feature providing access to NavGraphInterfaceUpdateStationByTag ROS2 services</description>
60+
</class>
61+
</library>
4262
</class_libraries>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/***************************************************************************
2+
* NavGraphCompute.hpp
3+
*
4+
* Automatically Generated: 2023-11-30 14:32:29
5+
****************************************************************************/
6+
7+
/* This program is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Library General Public License for more details.
16+
*
17+
* Read the full text in the LICENSE.GPL file in the doc directory.
18+
*/
19+
20+
#ifndef CX_FEATURES__NAVGRAPHCOMPUTE_HPP_
21+
#define CX_FEATURES__NAVGRAPHCOMPUTE_HPP_
22+
23+
#include <map>
24+
#include <memory>
25+
#include <string>
26+
27+
#include "cx_core/ClipsFeature.hpp"
28+
#include "cx_utils/LockSharedPtr.hpp"
29+
#include "cx_utils/NodeThread.hpp"
30+
31+
#include "rclcpp/rclcpp.hpp"
32+
#include "cx_msgs/srv/nav_graph_interface_compute.hpp"
33+
34+
namespace cx {
35+
36+
class NavGraphCompute : public ClipsFeature, public rclcpp::Node {
37+
public:
38+
NavGraphCompute();
39+
~NavGraphCompute();
40+
41+
void initialise(const std::string &feature_name) override;
42+
43+
bool clips_context_init(const std::string &env_name,
44+
LockSharedPtr<CLIPS::Environment> &clips) override;
45+
bool clips_context_destroyed(const std::string &env_name) override;
46+
47+
std::string getFeatureName() const;
48+
49+
private:
50+
std::map<std::string, LockSharedPtr<CLIPS::Environment>> envs_;
51+
std::thread spin_thread_;
52+
std::map<
53+
std::string,
54+
std::map<std::string, rclcpp::Client<cx_msgs::srv::NavGraphInterfaceCompute>::SharedPtr>>
55+
request_clients_;
56+
std::map<
57+
std::string,
58+
std::map<std::string, std::shared_ptr<cx_msgs::srv::NavGraphInterfaceCompute::Request>>>
59+
requests_;
60+
void create_request(const std::string &env_name,
61+
const std::string &service_name);
62+
63+
void set_field_request(const std::string &env_name,
64+
const std::string &service_name,
65+
const std::string &field_name, CLIPS::Value value);
66+
67+
void set_array_request(const std::string &env_name,
68+
const std::string &service_name,
69+
const std::string &field_name, CLIPS::Values values);
70+
71+
void request_from_node(const std::string &env_name,
72+
const std::string &service_name);
73+
74+
void service_callback(
75+
rclcpp::Client<cx_msgs::srv::NavGraphInterfaceCompute>::SharedFuture response,
76+
std::string service_name, std::string env_name);
77+
};
78+
} // namespace cx
79+
#endif // !CX_FEATURES__NAVGRAPHCOMPUTE_HPP_
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/***************************************************************************
2+
* NavGraphGenerateWaitzones.hpp
3+
*
4+
* Automatically Generated: 2023-11-30 14:38:37
5+
****************************************************************************/
6+
7+
/* This program is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Library General Public License for more details.
16+
*
17+
* Read the full text in the LICENSE.GPL file in the doc directory.
18+
*/
19+
20+
#ifndef CX_FEATURES__NAVGRAPHGENERATEWAITZONES_HPP_
21+
#define CX_FEATURES__NAVGRAPHGENERATEWAITZONES_HPP_
22+
23+
#include <map>
24+
#include <memory>
25+
#include <string>
26+
27+
#include "cx_core/ClipsFeature.hpp"
28+
#include "cx_utils/LockSharedPtr.hpp"
29+
#include "cx_utils/NodeThread.hpp"
30+
31+
#include "rclcpp/rclcpp.hpp"
32+
#include "cx_msgs/srv/nav_graph_interface_generate_waitzones.hpp"
33+
34+
namespace cx {
35+
36+
class NavGraphGenerateWaitzones : public ClipsFeature, public rclcpp::Node {
37+
public:
38+
NavGraphGenerateWaitzones();
39+
~NavGraphGenerateWaitzones();
40+
41+
void initialise(const std::string &feature_name) override;
42+
43+
bool clips_context_init(const std::string &env_name,
44+
LockSharedPtr<CLIPS::Environment> &clips) override;
45+
bool clips_context_destroyed(const std::string &env_name) override;
46+
47+
std::string getFeatureName() const;
48+
49+
private:
50+
std::map<std::string, LockSharedPtr<CLIPS::Environment>> envs_;
51+
std::thread spin_thread_;
52+
std::map<
53+
std::string,
54+
std::map<std::string, rclcpp::Client<cx_msgs::srv::NavGraphInterfaceGenerateWaitzones>::SharedPtr>>
55+
request_clients_;
56+
std::map<
57+
std::string,
58+
std::map<std::string, std::shared_ptr<cx_msgs::srv::NavGraphInterfaceGenerateWaitzones::Request>>>
59+
requests_;
60+
void create_request(const std::string &env_name,
61+
const std::string &service_name);
62+
63+
void set_field_request(const std::string &env_name,
64+
const std::string &service_name,
65+
const std::string &field_name, CLIPS::Value value);
66+
67+
void set_array_request(const std::string &env_name,
68+
const std::string &service_name,
69+
const std::string &field_name, CLIPS::Values values);
70+
71+
void request_from_node(const std::string &env_name,
72+
const std::string &service_name);
73+
74+
void service_callback(
75+
rclcpp::Client<cx_msgs::srv::NavGraphInterfaceGenerateWaitzones>::SharedFuture response,
76+
std::string service_name, std::string env_name);
77+
};
78+
} // namespace cx
79+
#endif // !CX_FEATURES__NAVGRAPHGENERATEWAITZONES_HPP_
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/***************************************************************************
2+
* NavGraphSetBoundingBox.hpp
3+
*
4+
* Automatically Generated: 2023-11-30 14:34:21
5+
****************************************************************************/
6+
7+
/* This program is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Library General Public License for more details.
16+
*
17+
* Read the full text in the LICENSE.GPL file in the doc directory.
18+
*/
19+
20+
#ifndef CX_FEATURES__NAVGRAPHSETBOUNDINGBOX_HPP_
21+
#define CX_FEATURES__NAVGRAPHSETBOUNDINGBOX_HPP_
22+
23+
#include <map>
24+
#include <memory>
25+
#include <string>
26+
27+
#include "cx_core/ClipsFeature.hpp"
28+
#include "cx_utils/LockSharedPtr.hpp"
29+
#include "cx_utils/NodeThread.hpp"
30+
31+
#include "rclcpp/rclcpp.hpp"
32+
#include "cx_msgs/srv/nav_graph_interface_set_bounding_box.hpp"
33+
34+
namespace cx {
35+
36+
class NavGraphSetBoundingBox : public ClipsFeature, public rclcpp::Node {
37+
public:
38+
NavGraphSetBoundingBox();
39+
~NavGraphSetBoundingBox();
40+
41+
void initialise(const std::string &feature_name) override;
42+
43+
bool clips_context_init(const std::string &env_name,
44+
LockSharedPtr<CLIPS::Environment> &clips) override;
45+
bool clips_context_destroyed(const std::string &env_name) override;
46+
47+
std::string getFeatureName() const;
48+
49+
private:
50+
std::map<std::string, LockSharedPtr<CLIPS::Environment>> envs_;
51+
std::thread spin_thread_;
52+
std::map<
53+
std::string,
54+
std::map<std::string, rclcpp::Client<cx_msgs::srv::NavGraphInterfaceSetBoundingBox>::SharedPtr>>
55+
request_clients_;
56+
std::map<
57+
std::string,
58+
std::map<std::string, std::shared_ptr<cx_msgs::srv::NavGraphInterfaceSetBoundingBox::Request>>>
59+
requests_;
60+
void create_request(const std::string &env_name,
61+
const std::string &service_name);
62+
63+
void set_field_request(const std::string &env_name,
64+
const std::string &service_name,
65+
const std::string &field_name, CLIPS::Value value);
66+
67+
void set_array_request(const std::string &env_name,
68+
const std::string &service_name,
69+
const std::string &field_name, CLIPS::Values values);
70+
71+
void request_from_node(const std::string &env_name,
72+
const std::string &service_name);
73+
74+
void service_callback(
75+
rclcpp::Client<cx_msgs::srv::NavGraphInterfaceSetBoundingBox>::SharedFuture response,
76+
std::string service_name, std::string env_name);
77+
};
78+
} // namespace cx
79+
#endif // !CX_FEATURES__NAVGRAPHSETBOUNDINGBOX_HPP_

0 commit comments

Comments
 (0)