# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

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

# A position and orientation for an object or reference frame in 3D space
class Pose(object):
    __slots__ = ['_tab']

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

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

    # Point denoting position in 3D space
    # Pose
    def Position(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        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

    # Quaternion denoting orientation in 3D space
    # Pose
    def Orientation(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        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 PoseStart(builder): builder.StartObject(2)
def Start(builder):
    return PoseStart(builder)
def PoseAddPosition(builder, position): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(position), 0)
def AddPosition(builder, position):
    return PoseAddPosition(builder, position)
def PoseAddOrientation(builder, orientation): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(orientation), 0)
def AddOrientation(builder, orientation):
    return PoseAddOrientation(builder, orientation)
def PoseEnd(builder): return builder.EndObject()
def End(builder):
    return PoseEnd(builder)