It’s been a busy period here at YardBot HQ, which means I haven’t had a whole lot of time available to build robots. Some of that time has been spent writing a library for iOS that allows communication with ROS over a websocket. Called RBManager it uses Objective-C and the ROSBridge component to send messages back and forth. I received lots of good feedback about that library but a common request was for an updated Swift version.
When I finally had time to review the library, I rebuilt it in Swift and released a new version, called RBSManager. The S stands for Swift.
The library itself was my first exposure to building a CocoaPod so integrating it into your project is quite simple. It uses Starscream for sockets and ObjectMapper for mapping JSON to objects.
Open the demo project to see how to create messages, subscribers and publishers, but here’s tour of some of the things I added, based on the Turtlesim.
The main screen shows a turtle icon to demonstrate subscribing to a topic (/turtle1/pose). The x, y and theta values will update based on the turtle position. The turtle will also rotate based on the theta angle.
The service call buttons do various configuration actions that the turtlesim exposes and the colour button is shown below.
The direction buttons below that will generate a message to move and rotate the turtle around the screen. Multiple buttons can be held at once to make different shapes on screen.
One option provided by the action buttons is to change the colour of the turtlesim background. This demonstrates how to send a service call with parameters. Adjust the colour sliders to select the desired shade and send it to the ROS master. Soon I should have my external robot hardware updated to the point where I can control Arduino colours again!
I was pleased to hear from users of the original RBManager library who had integrated it into their projects. I think it’s actually being used by a company that builds human interface robots. One of the catalysts for building the Swift version of the library was when someone from Paradigm Hyperloop contacted me about it, so hopefully something I made is going into that project!