Ask Your Question

ROS2 Messages not generated for 3rd party clients

asked 2020-07-15 21:48:03 -0500

atyshka gravatar image

I am working on developing a swift client library for ROS2, building off of the work from @esteve on rcldotnet. I modified the generation appropriately to adapt it to swift, but messages are not being generated. It appears that it is not being properly registered with cmake. My procedure consists of cloning my repo along with common_interfaces, and building. Digging through build and install, generation occurs for c++ and python, but not swift. I would think the relevant section of the CMakeLists would be ament_index_register_resource("rosidl_generator_packages") but clearly that isn't working. If anyone has a few minutes to attempt to reproduce, I'd greatly appreciate some assistance! Clone and build with colcon build --cmake-args " -GNinja" --event-handlers console_direct+ Note that you'll need ninja, installable via apt, and swift for linux installed via debs here:

edit retag flag offensive close merge delete


The package rosidl_generator_swift declares dependencies on rmw_implementation which isn't feasible since it introduced a circular dependency. For me colcon errors out right away.

Assuming tests are enables it then fails since in the package.xml the test dependencies on ament_lint_auto and ament_lint_common are commented out even though they are used in the CMake file.

Next the CMake logic fails to install the not existing executable: bin/rosidl_generator_swift.

Then it fails to find a valid typesupport for Swift when trying to build the first message package. The macro rosidl_generator_swift_get_typesupportsprobably needs a similar fix than this one:

At this point I couldn't see where a Swift specific typesupport was supposed to come from...

Dirk Thomas gravatar image Dirk Thomas  ( 2020-07-20 14:50:06 -0500 )edit

I figured out the issue, I needed to build some more packages from source like rosidl and rosidl_defaults repos. Yes there are many errors still to be resolved as this is still very much an incomplete work in progress. Thanks for the tips though!

atyshka gravatar image atyshka  ( 2020-07-20 20:56:37 -0500 )edit

@Dirk Thomas, the package.xml works fine for me with colcon, and was copied from ros2_dotnet. Maybe file an issue there?

atyshka gravatar image atyshka  ( 2020-07-20 21:07:32 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-07-17 05:03:10 -0500

esteve gravatar image

I am working on developing a swift client library for ROS2, building off of the work from @esteve on rcldotnet.

In that case, it may help to build on top of , it already supports message generation and basic pubsub for Objective-C, so adding Swift bindings on top of the Objective-C API will save you a lot of time, since message generation is already there. I know for a fact that mixing ros2_objc with Swift works fine.

edit flag offensive delete link more


I've chosen to undertake the work of starting from scratch, mainly because (correct me if I'm wrong) the current Objective C doesn't seem to be updated past Crystal and lack support for a lot of things like nested types, arrays, executors/multithreading, and multi-node composition. It'll be a fair amount of work, but knowing next to zero Objective C, using pure swift seems easier for me. Both Objective C and dotnet will be a great reference though for the project, thanks for your contributions there!

atyshka gravatar image atyshka  ( 2020-07-20 21:04:13 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-07-15 21:48:03 -0500

Seen: 123 times

Last updated: Jul 17 '20