Skip to content

Defining default_port_value for ROS2 plugins #69

Closed
@marj3220

Description

@marj3220

TL:DR How can the default_port_value of a ROS2 BT Node be set when using the new plugin architecture?

Context

Normally a ROS2 BT node would be set this way:

// in main()
  BehaviorTreeFactory factory;

  auto node = std::make_shared<rclcpp::Node>("fibonacci_action_client");
  // provide the ROS node and the name of the action service
  RosNodeParams params; 
  params.nh = node;
  params.default_port_value = "fibonacci";
  factory.registerNodeType<FibonacciAction>("Fibonacci", params);

Problem when using macro from BT.CPP:

Using the bt_factory.h (BT.CPP) for creating a non-ROS plugin is straightforward, but when adding ROS2 necessities the ROS node goes out of scope.

Code:

image

Result:

image

Problem when using macro from BT.ROS2:

Inversly, when using the plugins.hpp (BT.ROS2) macro, I can't find how to set the params:

Code:

image

Result:

image

So how should a ROS2 plugin be set with its params?

Thank you in advance!

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