"""LCM type definitions
This file automatically generated by lcm.
DO NOT MODIFY BY HAND!!!!
"""

try:
    import cStringIO.StringIO as BytesIO
except ImportError:
    from io import BytesIO
import struct

class kalman_args_t(object):
    __slots__ = ["input_rpy", "input_acc", "input_dt", "valid_vicon", "meas_xyz", "smooth_xyz", "smooth_dxyz"]

    def __init__(self):
        self.input_rpy = [ 0.0 for dim0 in range(3) ]
        self.input_acc = [ 0.0 for dim0 in range(3) ]
        self.input_dt = 0.0
        self.valid_vicon = False
        self.meas_xyz = [ 0.0 for dim0 in range(3) ]
        self.smooth_xyz = [ 0.0 for dim0 in range(3) ]
        self.smooth_dxyz = [ 0.0 for dim0 in range(3) ]

    def encode(self):
        buf = BytesIO()
        buf.write(kalman_args_t._get_packed_fingerprint())
        self._encode_one(buf)
        return buf.getvalue()

    def _encode_one(self, buf):
        buf.write(struct.pack('>3d', *self.input_rpy[:3]))
        buf.write(struct.pack('>3d', *self.input_acc[:3]))
        buf.write(struct.pack(">db", self.input_dt, self.valid_vicon))
        buf.write(struct.pack('>3d', *self.meas_xyz[:3]))
        buf.write(struct.pack('>3d', *self.smooth_xyz[:3]))
        buf.write(struct.pack('>3d', *self.smooth_dxyz[:3]))

    def decode(data):
        if hasattr(data, 'read'):
            buf = data
        else:
            buf = BytesIO(data)
        if buf.read(8) != kalman_args_t._get_packed_fingerprint():
            raise ValueError("Decode error")
        return kalman_args_t._decode_one(buf)
    decode = staticmethod(decode)

    def _decode_one(buf):
        self = kalman_args_t()
        self.input_rpy = struct.unpack('>3d', buf.read(24))
        self.input_acc = struct.unpack('>3d', buf.read(24))
        self.input_dt = struct.unpack(">d", buf.read(8))[0]
        self.valid_vicon = bool(struct.unpack('b', buf.read(1))[0])
        self.meas_xyz = struct.unpack('>3d', buf.read(24))
        self.smooth_xyz = struct.unpack('>3d', buf.read(24))
        self.smooth_dxyz = struct.unpack('>3d', buf.read(24))
        return self
    _decode_one = staticmethod(_decode_one)

    _hash = None
    def _get_hash_recursive(parents):
        if kalman_args_t in parents: return 0
        tmphash = (0x550a26ef4fa794dd) & 0xffffffffffffffff
        tmphash  = (((tmphash<<1)&0xffffffffffffffff)  + (tmphash>>63)) & 0xffffffffffffffff
        return tmphash
    _get_hash_recursive = staticmethod(_get_hash_recursive)
    _packed_fingerprint = None

    def _get_packed_fingerprint():
        if kalman_args_t._packed_fingerprint is None:
            kalman_args_t._packed_fingerprint = struct.pack(">Q", kalman_args_t._get_hash_recursive([]))
        return kalman_args_t._packed_fingerprint
    _get_packed_fingerprint = staticmethod(_get_packed_fingerprint)


"""LCM type definitions
This file automatically generated by lcm.
DO NOT MODIFY BY HAND!!!!
"""

try:
    import cStringIO.StringIO as BytesIO
except ImportError:
    from io import BytesIO
import struct

class kalman_args_t(object):
    __slots__ = ["input_rpy", "input_acc", "input_dt", "valid_vicon", "meas_xyz", "smooth_xyz", "smooth_dxyz"]

    def __init__(self):
        self.input_rpy = [ 0.0 for dim0 in range(3) ]
        self.input_acc = [ 0.0 for dim0 in range(3) ]
        self.input_dt = 0.0
        self.valid_vicon = False
        self.meas_xyz = [ 0.0 for dim0 in range(3) ]
        self.smooth_xyz = [ 0.0 for dim0 in range(3) ]
        self.smooth_dxyz = [ 0.0 for dim0 in range(3) ]

    def encode(self):
        buf = BytesIO()
        buf.write(kalman_args_t._get_packed_fingerprint())
        self._encode_one(buf)
        return buf.getvalue()

    def _encode_one(self, buf):
        buf.write(struct.pack('>3d', *self.input_rpy[:3]))
        buf.write(struct.pack('>3d', *self.input_acc[:3]))
        buf.write(struct.pack(">db", self.input_dt, self.valid_vicon))
        buf.write(struct.pack('>3d', *self.meas_xyz[:3]))
        buf.write(struct.pack('>3d', *self.smooth_xyz[:3]))
        buf.write(struct.pack('>3d', *self.smooth_dxyz[:3]))

    def decode(data):
        if hasattr(data, 'read'):
            buf = data
        else:
            buf = BytesIO(data)
        if buf.read(8) != kalman_args_t._get_packed_fingerprint():
            raise ValueError("Decode error")
        return kalman_args_t._decode_one(buf)
    decode = staticmethod(decode)

    def _decode_one(buf):
        self = kalman_args_t()
        self.input_rpy = struct.unpack('>3d', buf.read(24))
        self.input_acc = struct.unpack('>3d', buf.read(24))
        self.input_dt = struct.unpack(">d", buf.read(8))[0]
        self.valid_vicon = bool(struct.unpack('b', buf.read(1))[0])
        self.meas_xyz = struct.unpack('>3d', buf.read(24))
        self.smooth_xyz = struct.unpack('>3d', buf.read(24))
        self.smooth_dxyz = struct.unpack('>3d', buf.read(24))
        return self
    _decode_one = staticmethod(_decode_one)

    _hash = None
    def _get_hash_recursive(parents):
        if kalman_args_t in parents: return 0
        tmphash = (0x550a26ef4fa794dd) & 0xffffffffffffffff
        tmphash  = (((tmphash<<1)&0xffffffffffffffff)  + (tmphash>>63)) & 0xffffffffffffffff
        return tmphash
    _get_hash_recursive = staticmethod(_get_hash_recursive)
    _packed_fingerprint = None

    def _get_packed_fingerprint():
        if kalman_args_t._packed_fingerprint is None:
            kalman_args_t._packed_fingerprint = struct.pack(">Q", kalman_args_t._get_hash_recursive([]))
        return kalman_args_t._packed_fingerprint
    _get_packed_fingerprint = staticmethod(_get_packed_fingerprint)


LCM type definitions This file automatically generated by lcm. DO NOT MODIFY BY HAND!!!!