This app sends the measurements from your phone inertial sensors via UDP as CSV (Comma-Separated Values) to a computer in your network.
This turns your phone into a wireless inertial measurement unit (IMU).
The following sensors are supported:
- Accelerometer
- Gyroscope
- Magnetometer
If your phone has not all these sensors, only the available sensor data is transmitted.
Example UDP packet:
890.71558, 3, 0.076, 9.809, 0.565, 4, -0.559, 0.032, -0.134, 5, -21.660,-36.960,-28.140
Timestamp [sec], sensorid, x, y, z, sensorid, x, y, z, sensorid, x, y, z
Sensor id:
3 - Accelerometer (m/s^2)
4 - Gyroscope (rad/s)
5 - Magnetometer (micro-Tesla uT)
You can run this app in the background.
A warning dialog appears, if you are not connected to a WiFi network.
In the example video, the stream is directly processed by a MATLAB script for Kalman Filtering. But it's up to you, what you do with the data.
With the following Python script you can capture the UDP data stream from your phone:
# -------------------------------------------------------
import socket, traceback
host = ''
port = 5555
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.bind((host, port))
while 1:
try:
message, address = s.recvfrom(8192)
print message
except (KeyboardInterrupt, SystemExit):
raise
except:
traceback.print_exc()
# -------------------------------------------------------