Measurement Class

The Measurement class is the core data structure in flexlib, representing a single data point captured from the sensor at a specific moment in time.

Properties

  • timestamp (datetime): The date and time when the measurement was taken.
  • acc (list[float]): A list of three floating-point numbers representing the accelerometer data for the x, y, and z axes.
  • gyro (list[float]): A list of three floating-point numbers representing the gyroscope data for the x, y, and z axes.
  • angles (SensorAngles): An object containing the calculated angles from the sensor data, such as bend, twist, and alpha.

Usage Example

# This is a conceptual example. 
# Measurements are typically created by reading from a file.
from flexlib.models.measurement import Measurement
from flexlib.models.sensor_angles import SensorAngles
import datetime

# Creating a dummy Measurement object
angles = SensorAngles(alpha=[0.1, 0.2], beta=[0.3, 0.4], bend=15.0, twist=5.0)
measurement = Measurement(
    timestamp=datetime.datetime.now(),
    acc=[0.1, 0.2, 9.8],
    gyro=[0.01, 0.02, 0.03],
    angles=angles
)

print(f"Timestamp: {measurement.timestamp}")
print(f"Acceleration: {measurement.acc}")
print(f"Bend Angle: {measurement.angles.bend}")