Skip to content

Why doesn't TreeExecutionServer directly expose rclcpp::Node::SharedPtr? #63

Closed
@kenyoshizoe

Description

@kenyoshizoe

When I implemented the override of void registerNodesIntoFactory(BT::BehaviorTreeFactory& factory), I wrote it like this:

BT::RosNodeParams params;
params.nh = std::dynamic_pointer_cast<rclcpp::Node>(nodeBaseInterface());

This caused the following exceptions during tree construction:

[ERROR] [1715013001.175801122] [bt_action_server]: Behavior Tree exception:bad_weak_ptr
[ERROR] [1715013002.693655469] [bt_action_server]: Behavior Tree exception:The ROS node went out of scope. RosNodeParams doesn't take the ownership of the node.

Instead, when I changed the API to directly assign rclcpp::Node::SharedPtr to nh, it worked perfectly.
Why doesn't TreeExecutionServer directly expose rclcpp::Node::SharedPtr?
If there are no issues, I would like to add an API to directly exposerclcpp::Node::SharedPtr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions