# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

# A transform between two reference frames in 3D space
class FrameTransform(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = FrameTransform()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsFrameTransform(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # FrameTransform
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Timestamp of transform
    # FrameTransform
    def Timestamp(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = o + self._tab.Pos
            from .Time import Time
            obj = Time()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Name of the parent frame
    # FrameTransform
    def ParentFrameId(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Name of the child frame
    # FrameTransform
    def ChildFrameId(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Translation component of the transform
    # FrameTransform
    def Translation(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Vector3 import Vector3
            obj = Vector3()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Rotation component of the transform
    # FrameTransform
    def Rotation(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Quaternion import Quaternion
            obj = Quaternion()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

def FrameTransformStart(builder): builder.StartObject(5)
def Start(builder):
    return FrameTransformStart(builder)
def FrameTransformAddTimestamp(builder, timestamp): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(timestamp), 0)
def AddTimestamp(builder, timestamp):
    return FrameTransformAddTimestamp(builder, timestamp)
def FrameTransformAddParentFrameId(builder, parentFrameId): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(parentFrameId), 0)
def AddParentFrameId(builder, parentFrameId):
    return FrameTransformAddParentFrameId(builder, parentFrameId)
def FrameTransformAddChildFrameId(builder, childFrameId): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(childFrameId), 0)
def AddChildFrameId(builder, childFrameId):
    return FrameTransformAddChildFrameId(builder, childFrameId)
def FrameTransformAddTranslation(builder, translation): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(translation), 0)
def AddTranslation(builder, translation):
    return FrameTransformAddTranslation(builder, translation)
def FrameTransformAddRotation(builder, rotation): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(rotation), 0)
def AddRotation(builder, rotation):
    return FrameTransformAddRotation(builder, rotation)
def FrameTransformEnd(builder): return builder.EndObject()
def End(builder):
    return FrameTransformEnd(builder)