Exposed rcl_actions to the NodeGraph class#2188
Exposed rcl_actions to the NodeGraph class#2188CursedRock17 wants to merge 9 commits intoros2:rollingfrom
Conversation
|
@CursedRock17 thanks for the PR, i will take a look. in the meantime, can you address DCO error? https://github.com/ros2/rclcpp/pull/2188/checks?check_run_id=13298073729 |
7c7bb78 to
f79c1f8
Compare
fujitatomoya
left a comment
There was a problem hiding this comment.
in addition to comments, it would be ideal to add the test cases to rclcpp/test/rclcpp/node_interfaces/test_node_graph.cpp.
8672eaa to
b8229db
Compare
The most recent commit I pushed contained the tests for the |
|
@CursedRock17 thanks for iterating and being responsive. i will take a look tomorrow, in the meantime can you address DCO error? |
05ce539 to
0218076
Compare
fujitatomoya
left a comment
There was a problem hiding this comment.
Can you also add the test cases to check if it can actually get names and types? for example,
f44e614 to
5c37c93
Compare
fujitatomoya
left a comment
There was a problem hiding this comment.
@CursedRock17 can you check building and testing with your local environment? i cannot build or test this PR... thanks in advance.
|
|
||
| RCLCPP_PUBLIC | ||
| std::map<std::string, std::vector<std::string>> | ||
| get_action_names_and_types() const override; |
There was a problem hiding this comment.
I think this cannot be built since there is no virtual function exists. Could you update NodeGraphInterface accordingly?
There was a problem hiding this comment.
| EXPECT_THROW( | ||
| node_graph()->get_action_names_and_types("action", false), | ||
| rclcpp::exceptions::RCLError); | ||
|
|
There was a problem hiding this comment.
Needs brackets at the end of this test case?
| } | |
| auto client = | ||
| node()->create_client<test_msgs::srv::Empty>("node1_service"); |
There was a problem hiding this comment.
i think we need to create action but service for this test case.
|
|
||
| TEST_F(TestNodeGraph, get_action_client_names_and_types_by_node_rcl_error) | ||
| { | ||
| auto client = node()->create_client<test_msgs::srv::Empty>("node1_service"); |
There was a problem hiding this comment.
same here, this is creating service but action. rclcpp_action::create_client should be called instead.
There was a problem hiding this comment.
While this makes sense, I cannot include the rclcpp_action part of the library in the rclcpp section, otherwise a linking error is thrown because rclcpp_action uses rclcpp, so this would result in an infinite loop. We need to both, have these functions in the node_graph_interface section, and utilize the rclcpp_action commands.
There was a problem hiding this comment.
One thing that we could do is add specifically the tests to the rclcpp_action part of the rclcpp library with a new file along the names of test_action_calls. Since rclcpp_action has to include rclcpp in its cmake file and already has the ability to include rclcpp_action::create_server there would be no linking issues. The problem is just the location of these files because the rcl_action wrapper interfaces are in the rclcpp/nodeinterfaces section of the codebase, which makes this location a bit awkward for naming purpose. The functions like get_action_types_and_names make the most sense where they are now, but it seems the tests have to be moved simply because including rclcpp_action in rclcpp isn't possible.
There was a problem hiding this comment.
This conversation is making me question whether we want to expose this as part of rclcpp at all. That is, I wonder if it would make more sense to move all of this to rclcpp_action (possibly with a new NodeActionGraph class), which avoids this whole problem. That said, I haven't looked at this implementation closely yet, so maybe this doesn't make much sense.
There was a problem hiding this comment.
I would have to agree with moving this entire implementation to rclcpp_action. The folder is already quite slim with files and seems to be a better place to place wrapped rcl_action functions. While keeping all three of these functions in the node_graph.cpp section would be simpler; the fact that we would need to move tests to a different part of the project entirely showcases a design flaw.
There was a problem hiding this comment.
I'm now less confident in moving the entire implementation of NodeGraph into rclcpp_action as NodeActionGraph. While we are only using it for action based activities, it's not action specific, simply just an rcl_action wrapper, we then have to move all of the other general overrides to this new class. This will add another ~500 lines that we probably could have avoided.
Additionally, if the user has some long-running process using an action server/client, while they have a small publisher/subscriber maybe keeping track of the environment, they won't be able to track these processes from one NodeGraph. If we did move the action side of things over to a new class, they have to create both a NodeGraph and NodeActionGraph, so if the user were to call get_graph_event and gain another user on the NodeGraph, the NodeActionGraph wouldn't see that change, thus won't be able to accurately track the processes running.
|
|
||
| TEST_F(TestNodeGraph, get_action_client_names_and_types_by_node_rcl_fini_error) | ||
| { | ||
| auto client = node()->create_client<test_msgs::srv::Empty>("node1_service"); |
| }; | ||
| auto handle_accepted = [](std::shared_ptr<test_msgs::msg::Empty>){}; | ||
|
|
||
| const server = node()->create_server<test_msgs::msg::Empty( |
There was a problem hiding this comment.
same here, this is service.
Yes I can test, I can do it on both my computer and Docker for Ubuntu 22.04 correct? |
yes, as long as the userland is Ubuntu 22.04, i believe there should be no problem for this PR verification. |
Signed-off-by: CursedRock17 <mtglucas1@gmail.com>
Signed-off-by: CursedRock17 <mtglucas1@gmail.com>
Signed-off-by: CursedRock17 <mtglucas1@gmail.com>
Signed-off-by: CursedRock17 <mtglucas1@gmail.com>
Signed-off-by: CursedRock17 <mtglucas1@gmail.com>
Signed-off-by: CursedRock17 <mtglucas1@gmail.com>
Signed-off-by: CursedRock17 <mtglucas1@gmail.com>
Signed-off-by: CursedRock17 <mtglucas1@gmail.com>
Signed-off-by: CursedRock17 <mtglucas1@gmail.com> Making requests action related Signed-off-by: CursedRock17 <mtglucas1@gmail.com> Testing suite Signed-off-by: CursedRock17 <mtglucas1@gmail.com> Moving Tests Signed-off-by: CursedRock17 <mtglucas1@gmail.com>
c6637db to
021568f
Compare
This pull request is meant to address issue #1473 which needs rcl_action functions exposed to the NodeGraph class. As mentioned:
were all meant to be exposed from rcl to rclcpp, which based on the previous comment meant to make methods similar to rclpy. So each of the functions developed in this PR all follow a similar format of gaining access to the original rcl_action methods with a rcl_ret_t type and return a map of all the names and types.