# Confusion about move\_group node creation (ROS2, C++) in Open Class #148

**URL:** <https://get-help.theconstruct.ai/t/confusion-about-move-group-node-creation-ros2-c-in-open-class-148/18642>\
**Category:** General Support\
**Tags:** ros2, motion-planning\
**Created:** [August 9, 2022, 8:57am UTC](https://get-help.theconstruct.ai/t/confusion-about-move-group-node-creation-ros2-c-in-open-class-148/18642 "2022-08-09T08:57:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![comala](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/c/e19b73/32.png) [@comala](https://get-help.theconstruct.ai/u/comala)\
**Post date:** [August 9, 2022, 8:57am UTC](https://get-help.theconstruct.ai/t/confusion-about-move-group-node-creation-ros2-c-in-open-class-148/18642/1 "2022-08-09T08:57:16Z")

</div>

Hi,

in the ROS2 Motion Planning using C++ | ROS2 Developers Open Class [#148], the main looks as follows:

```auto
int main(int argc, char **argv) {
  rclcpp::init(argc, argv);
  rclcpp::NodeOptions node_options;
  node_options.automatically_declare_parameters_from_overrides(true);
  auto move_group_node =
      rclcpp::Node::make_shared("move_group_demo", node_options);

  rclcpp::executors::SingleThreadedExecutor planner_executor;
  std::shared_ptr<TestTrajectory> planner_node =
      std::make_shared<TestTrajectory>(move_group_node);
  planner_executor.add_node(planner_node);
  planner_executor.spin();

  rclcpp::shutdown();
  return 0;
}

```

I’m mainly confused about what exactly happens in the node creation. Why are we first creating the `move_group_node` and then the `planner_node`? Are they two separate nodes or what is their relation since we’re only adding the latter to the executor?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![albertoezquerro](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/albertoezquerro/32/7031_2.png) [@albertoezquerro](https://get-help.theconstruct.ai/u/albertoezquerro)\
**Post date:** [August 11, 2022, 9:47am UTC](https://get-help.theconstruct.ai/t/confusion-about-move-group-node-creation-ros2-c-in-open-class-148/18642/2 "2022-08-11T09:47:04Z")

</div>

Hello @comala ,

The **planner\_node** is an instance of the class **TestTrajectory** , as you can see:

`std::shared_ptr<TestTrajectory> planner_node`

And from the constructor, you can see that the class constructor is expecting to receive a node on initialization:

`TestTrajectory(std::shared_ptr<rclcpp::Node> move_group_node)`

This is why we need to create first the **move\_group\_node** in order to provide it to the class:

`std::make_shared<TestTrajectory>(move_group_node);`

Hope this helps clarify it.

---

<div class="post-metadata">

**Author:** ![comala](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/c/e19b73/32.png) [@comala](https://get-help.theconstruct.ai/u/comala)\
**Post date:** [August 11, 2022, 10:09am UTC](https://get-help.theconstruct.ai/t/confusion-about-move-group-node-creation-ros2-c-in-open-class-148/18642/3 "2022-08-11T10:09:20Z")

</div>

Thanks! It actually makes a lot of sense now 😉

---

<div class="post-metadata">

**Author:** ![system](https://get-help.theconstruct.ai/uploads/default/original/2X/9/9d3ce8305cc0d0d9b6e07d15767a6f245c526f1b.jpeg) [@system](https://get-help.theconstruct.ai/u/system)\
**Post date:** [August 21, 2022, 10:09am UTC](https://get-help.theconstruct.ai/t/confusion-about-move-group-node-creation-ros2-c-in-open-class-148/18642/4 "2022-08-21T10:09:59Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
