Quick Start
Receive data from the asMagic app on anywhere else (PC / laptop / Raspberry Pi...).
Last updated
Was this helpful?
Receive data from the asMagic app on anywhere else (PC / laptop / Raspberry Pi...).
Last updated
Was this helpful?
Was this helpful?
from asmagic import ARDataSubscriber
# Create subscriber with your iPhone's IP address
sub = ARDataSubscriber("192.168.1.100")
try:
# Continuous data streaming
for data in sub:
# All sensor data in one frame
print(f"Timestamp: {data.timestamp}")
print(f"Velocity: {data.velocity}")
print(f"Local Pose: {data.local_pose}")
print(f"Global Pose: {data.global_pose}")
print(f"Camera Intrinsics: {data.camera_intrinsics}")
# Access image data
if data.has_color_image:
# Color: bytes(jpeg format) or array
color_bytes = data.color_bytes
color_array = data.color_array # or shortcut: data.color
print(f"Color: {len(color_bytes)} bytes, array shape: {color_array.shape}")
if data.has_depth_image:
# Depth: Numpy array
depth = data.depth_array # or shortcut: data.depth
print(f"Depth: {depth.shape}")
except KeyboardInterrupt:
print("\nStopped by user")
finally:
sub.close()from asmagic import IMUDataSubscriber
#Create subscriber with your iPhone's IP address
sub = IMUDataSubscriber("192.168.1.100")
try:
# Continuous IMU data streaming
for data in sub:
print(f"Timestamp: {data.timestamp}")
print(f"Accelerometer (G): {data.accelerometer}")
print(f"Gyroscope (rad/s): {data.gyroscope}")
print(f"Magnetometer (μT): {data.magnetometer}")
print(f"Gravity (G): {data.gravity}")
print(f"User Acceleration (G): {data.user_acceleration}")
print(f"Attitude (quat): {data.attitude}")
except KeyboardInterrupt:
print("\nStopped by user")
finally:
sub.close()