Member-only story

Use iPhone as IMU in ROS

Pietro Colombo
3 min readMay 19, 2021

--

Photo by Jason Leung on Unsplash

For a project, I needed IMU data in ROS but didn’t have any sensors. So I used my iPhone by downloading the SensorLog App and writing a ROS node to receive real-time data and republish it on a topic.

The only thing is that the App I used costs $4.99, but if you find a free one and modify my code write it in the comments.

The ROS node works by enabling only from the application “unbiased: user acceleration, attitude, gravity, heading, magnetic field, rotation

This is my configuration:

Image by Author

After configuring the application, configure the ROS node by customizing the file “imu_from_ios_sensorlog.launch”.

To Run the node:

roslaunch imu_from_ios_sensorlog imu_from_ios_sensorlog.launch

After you launch you have to press in the App this button:

Image by Author

When the node starts compare the data you receive if it is in the same order as mine:

[ INFO] [1621330566.241296184]: loggingTime(txt)
[ INFO] [1621330566.241325444]: loggingSample(N)
[ INFO] [1621330566.241339310]: motionTimestamp_sinceReboot(s)
[ INFO] [1621330566.241351543]: motionYaw(rad)
[ INFO] [1621330566.241363859]: motionRoll(rad)
[ INFO] [1621330566.241393146]: motionPitch(rad)
[ INFO] [1621330566.241417663]: motionRotationRateX(rad/s)
[ INFO] [1621330566.241447628]: motionRotationRateY(rad/s)
[ INFO] [1621330566.241473765]: motionRotationRateZ(rad/s)
[ INFO] [1621330566.241497805]: motionUserAccelerationX(G)
[ INFO] [1621330566.241509503]: motionUserAccelerationY(G)
[ INFO] [1621330566.241531967]: motionUserAccelerationZ(G)
[ INFO] [1621330566.241543819]: motionAttitudeReferenceFrame(txt)
[ INFO] [1621330566.241558913]: motionQuaternionX(R)
[ INFO] [1621330566.241583371]: motionQuaternionY(R)
[ INFO] [1621330566.241606073]…

--

--

Pietro Colombo
Pietro Colombo

Written by Pietro Colombo

Robotics and Software engineering

Responses (1)

Write a response