Question about how Ros2 builds packages [closed]

asked 2020-11-04 21:14:35 -0600

lutinplunder gravatar image

I am re-writing a ros1 package for ros2 and had a question about how ros2 builds/compiles. I know that in c++ when you compile your code is combined into one file based upon your codes links, dependencies, etc. Does ROS2 work the same? The reason I ask is that I have about 2k lines of code broken up into six .cpp (servo driver, ik, ik algorithm, gait, control all under a node in the controller cpp). So I guess what I'm trying to ask is do I write the code as if it's one big file as far as pubs/subs are concerned and then the build/compile phase will put it all where it needs to go?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by lutinplunder
close date 2020-11-05 20:21:12.907868

Comments

1

There's no magic here. "ROS2" doesn't do anything special. What happens is that Colcon essentially just runs CMake, which will run make, which will call GCC to compile and link your binary.

This is the same process with or without Colcon. But without it, it would be you, manually running CMake, which then runs make, etc, etc.

So if you know how this works with plain CMake. You know how it works "in ROS2" (which is not really something you can say, as there's nothing there which is different).

gvdhoorn gravatar image gvdhoorn  ( 2020-11-05 05:24:23 -0600 )edit