Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

components: add NodeWithMode class #30

Merged
merged 3 commits into from
Feb 27, 2024
Merged

components: add NodeWithMode class #30

merged 3 commits into from
Feb 27, 2024

Conversation

GuillaumeLaine
Copy link
Member

@GuillaumeLaine GuillaumeLaine commented Feb 23, 2024

Changes

  • Adds template classes NodeWithMode and NodeWithModeExecutor to factorize repeated code in examples.
    • NodeWithMode<ModeT> instantiates and registers a mode of type ModeT.
    • NodeWithModeExecutor<ExecutorModeT, ModeT> instantiates and registers a mode executor of type ExecutorModeT. Also instantiates a mode of type ModeT, whose ownership is passed to the executor.
  • Add doxygen group and subgroups for utils/ folder.
    • In Doxyfile, set EXTRACT_STATIC = YES because many utils functions are static qualified and weren't shown.

Example usage NodeWithMode:

class MyMode : public px4_ros2::ModeBase {...};
rclcpp::spin(std::make_shared<px4_ros2::NodeWithMode<MyMode>>("my_node"));

Example usage NodeWithModeExecutor:

class MyMode : public px4_ros2::ModeBase {...};
class MyExecutor : public px4_ros2::ModeExecutor {...};
rclcpp::spin(std::make_shared<px4_ros2::NodeWithMode<MyExecutor, MyMode>>("my_node"));

Discussion

Alternative name ideas for NodeWithMode?

  • ModeControlNode
  • ModeHandlingNode / ModeHandlerNode
  • ...

JIRA: APX4-3823

@GuillaumeLaine GuillaumeLaine marked this pull request as draft February 23, 2024 08:48
Base automatically changed from local_global_conversion to main February 26, 2024 08:06
@GuillaumeLaine GuillaumeLaine force-pushed the node_with_mode branch 6 times, most recently from 9a43ef3 to 83297aa Compare February 26, 2024 12:40
@GuillaumeLaine GuillaumeLaine marked this pull request as ready for review February 26, 2024 13:00
@bkueng bkueng merged commit 09e9d15 into main Feb 27, 2024
8 checks passed
@bkueng bkueng deleted the node_with_mode branch February 27, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants