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 - GitHub - esteve/ros2_objc: Objective C and iOS bindings for ROS2
2 - https://github.com/ros2/rmw_fastrtps/pull/75
3 - Add support for pthread-based thread local storage by esteve · Pull Request #80 · ros2/rmw · GitHub
4 - Use Xcode as system generator and builder on OSX by esteve · Pull Request #127 · ament/ament_tools · GitHub
5 - Build shared libraries by default, but honor BUILD_SHARED_LIBS by esteve · Pull Request #128 · ament/ament_tools · GitHub
6 - Control shared/static linking via EPROSIMA_HONOR_BUILD_SHARED_LIBS and BUILD_SHARED_LIBS by esteve · Pull Request #8 · eProsima/Fast-CDR · GitHub
7 - Control shared/static linking via BUILD_SHARED_LIBS by esteve · Pull Request #93 · ros2/rcl · GitHub
8 - Control shared/static linking via BUILD_SHARED_LIBS by esteve · Pull Request #81 · ros2/rmw · GitHub
9 - Control shared/static linking via BUILD_SHARED_LIBS by esteve · Pull Request #183 · ros2/rosidl · GitHub
10 - Removed Boost and ported to C++11. Added support for Android and iOS by esteve · Pull Request #26 · eProsima/Fast-DDS · GitHub

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