ROS2 C++ humble - 5.8 - Useless line?

This line doesn’t seem to do anything relevant to the code:

int main(int argc, char *argv[]) {
  rclcpp::init(argc, argv);

  // Instantiate the Node
  float sleep_time1 = 1.0;
  float sleep_time2 = 3.0;
  std::shared_ptr<TwoTimer> two_timer_node =
      std::make_shared<TwoTimer>(sleep_time1, sleep_time2);

  rclcpp::Node::make_shared("executor_example_5_node");   <------- HERE

  // Initialize one executor object
  rclcpp::executors::MultiThreadedExecutor executor;
  executor.add_node(two_timer_node);
  executor.spin();

  rclcpp::shutdown();
  return 0;
}

Hello @systems4you ,

You are totally right. I’ve just removed this line from the example code. Many thanks for your feedback!

Thanks Alberto! I think this section should be reviewed, the info is great (as usual) but there are typos in a few “source” commands, missing colcon commands, the line of code i told you about is present in more than one example. Definitely needs some polishing.

Keep up the good content :wink: