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

is there a reason why rclcpp_components/register_node_macro.hpp is included at the bottom of the source file vs the top, when writing a composition?

asked 2020-08-05 14:24:12 -0500

asobhy gravatar image

is there a reason why rclcpp_components/register_node_macro.hpp is included at the bottom of the source file vs the top, when writing a composition?

The file in the link below shows rclcpp_components/register_node_macro.hpp included at the bottom: https://github.com/ros2/demos/blob/ma...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-08-05 18:09:43 -0500

Geoff gravatar image

It's more convention than anything else. It will still work even if you put it at the top of the file, but putting it at the end means that you see the node implementation first. You could also look at it as saying "I've defined this node, now register it" in a procedural sort of way.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2020-08-05 14:24:12 -0500

Seen: 492 times

Last updated: Aug 05 '20