Don’t buy expensive sensors for your robot — use your smartphone

Everybody carries advanced sensors in their pockets each day. Camera, accelerometer, gyro, pressure sensor, proximity sensor and many more - they are all embedded into your smartphone. Now you can use them in your robot, for free.

Let me introduce hNode - free Android app from Husarion. What is does is provide a ROS node with the access to real-time smartphone sensor data. hNode is connected to the robotic system through Husarnet — a P2P, VPN network dedicated for robotics.

Devices connected to Husarnet network can be considered as one, distributed, virtual robot where each of the elements communicate with each other through the Internet. It doesn’t really matter whether they are in the same network or not. All hosts can see each other through hostname or IPv6 private address. Providing data through such a network is very fast because devices are directly connected to each other without a central cloud forwarding the traffic. It also works with embedded devices. Husarion cloud is used only for one-time setup of the Virtual Robot network and for adding additional elements to it — such as smartphone with a hNode app.

To add hNode to your Virtual Robot all you have to do is to generate and scan a QR code from cloud.husarion.com and choose a name for your smartphone.

After the process your phone becomes a ROS node.

That node provides sensor data as standard ROS topics. Just type in Linux terminal:

rostopic list /myphone1/

to display ROS topics provided by your smartphone.

To preview data from a single topic, eg. pressure sensor you can use that command inside any ROS device within the Husarnet network

rostopic echo /myphone1/pressure

Preview from IMU gives not only accelerometer or gyro data, but also a full orientation in quaternion notation:

Previewing the image from one of the two availables camera can be done by the following command:

rosrun image_view image_view image:=/myphone1/camera0/image _image_transport:=compressed

To let you kickstart your project using hNode app we’ve created a tutorial showing you how to create a Virtual Robot containing a simple robot based on CORE2-ROS (running ROS) controller, LEGO Mindstorms mechanics, a laptop (also running ROS) and a smartphone with hNode Android app.

Husarion provides a technology which accelerates robot development process. hNode is the next element that will help you easily achieve your goal of creating advanced robots effortlessly and in reasonable price. I hope you’ll like it :).

Like what you read? Give Dominik Nowak a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.