import ctypes
import math

ICD1553_ANGULAR_RATE_SC_LSB = 2.44141E-04
GC_K_PI = math.pi
ICD1553_ALGULAR_RATE_RAD_LSB = ICD1553_ANGULAR_RATE_SC_LSB * GC_K_PI

class AngAcc(ctypes.Structure):
    _fields_ = [
        ("raw", ctypes.c_int16),
        ("roll_ang_acc", ctypes.c_int16),
        ("pitch_ang_acc", ctypes.c_int16),
        ("yaw_ang_acc", ctypes.c_int16),
        ]

    def get(self):
        return self.raw * ICD1553_ALGULAR_RATE_RAD_LSB

    def set(self, value):
        self.raw = int(value / ICD1553_ALGULAR_RATE_RAD_LSB)