ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

The issue is caused by your component not having the correct constructor signature required for a component. Components must have a constructor that takes rclcpp::NodeOptions as the only argument. So, simply add another constructor that calls the constructor you already have:

In your header file,

 COMPOSITION_PUBLIC
 explicit Test(const rclcpp::NodeOptions &options);
 COMPOSITION_PUBLIC
 explicit Test(const std::string &test_ID, const rclcpp::NodeOptions &options);

In your source file,

Test::Test(const rclcpp::NodeOptions &options)
: Test("", options)
{}

Test::Test(const std::string &test_ID, const rclcpp::NodeOptions &options)
: Node(test_ID, options)
{
    RCLCPP_INFO(get_logger(), "Configuring Node...");
    test_name = test_ID;

    test_publisher         = create_publisher<std_msgs::msg::float32>(test_name + "/speed", 0);
    test_publisher_timer   = create_wall_timer(500ms, std::bind(&Test::timer_callback, this));
}

The issue is caused by your component not having the correct constructor signature required for a component. Components must have a constructor that takes rclcpp::NodeOptions as the only argument. So, simply add another constructor that calls the constructor you already have:have to fix this issue.

In your header file,

 COMPOSITION_PUBLIC
 explicit Test(const rclcpp::NodeOptions &options);
 COMPOSITION_PUBLIC
 explicit Test(const std::string &test_ID, const rclcpp::NodeOptions &options);

In your source file,

Test::Test(const rclcpp::NodeOptions &options)
: Test("", options)
{}

Test::Test(const std::string &test_ID, const rclcpp::NodeOptions &options)
: Node(test_ID, options)
{
    RCLCPP_INFO(get_logger(), "Configuring Node...");
    test_name = test_ID;

    test_publisher         = create_publisher<std_msgs::msg::float32>(test_name + "/speed", 0);
    test_publisher_timer   = create_wall_timer(500ms, std::bind(&Test::timer_callback, this));
}