Announcing Objective C on macOS and iOS for ROS2

Hi folks,

I just made public ros2_objc [1], a set of tools for building ROS2 applications in Objective C (including iPhones and iPads!), I had the code on a shelf getting all dusty and never found time for writing proper (-ish) instructions on how to build it.

Anyway, it’s on GitHub and it’s licensed under the Apache 2.0 license, so feel free to tinker with it and let me know what you think.

There’s a bunch of ROS2 pull requests that need to be merged for this to work though [2][3][4][5][6][7][8][9][10], but I hope I’ll have time to address any feedback this week.

The list of features include:

  • Generation of all builtin ROS types
  • Support for publishers and subscriptions
  • Clients and services
  • Support for iOS (iPhone, iPad)

Unfortunately, the bindings and the generator are not complete and currently lack:

  • Support for QoS
  • Support for complex types, constants, lists and default values
  • Access to the ROS2 graph

Have fun!

1 - https://github.com/esteve/ros2_objc
2 - https://github.com/ros2/rmw_fastrtps/pull/75
3 - https://github.com/ros2/rmw/pull/80
4 - https://github.com/ament/ament_tools/pull/127
5 - https://github.com/ament/ament_tools/pull/128
6 - https://github.com/eProsima/Fast-CDR/pull/8
7 - https://github.com/ros2/rcl/pull/93
8 - https://github.com/ros2/rmw/pull/81
9 - https://github.com/ros2/rosidl/pull/183
10 - https://github.com/eProsima/Fast-RTPS/pull/26

2 Likes

I am not very familiar with the Apple ecosystem of languages, but Swift looks like a pretty interesting language.

Will the Objective C bindings be accessible from within a Swift programming, or will there need to be a separate Swift client library? How about when using Swift on Linux?

It is great to see ROS2 supported on so many different platforms/languages!

Yes, it’s possible to add Swift into the mix, just follow Apple’s instructions:

https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

I targeted Objective C because it’s easier to integrate with existing code, and generating ROS2 code for it is fairly straightforward, compared to Swift. But in the end, you can just write an application in Swift and import the Objective C bindings.

1 Like