# automatically generated by the FlatBuffers compiler, do not modify

# namespace: isp

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

class Obs(object):
    __slots__ = ['_tab']

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

    @classmethod
    def GetRootAsObs(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    @classmethod
    def ObsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
        return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x49\x53\x50\x46", size_prefixed=size_prefixed)

    # Obs
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Obs
    def EgoLocation(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = o + self._tab.Pos
            from communications.isp.Location import Location
            obj = Location()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Obs
    def EgoRotation(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = o + self._tab.Pos
            from communications.isp.Rotation import Rotation
            obj = Rotation()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Obs
    def Speed(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
        return 0.0

    # Obs
    def FrontImage(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from communications.isp.Tensor import Tensor
            obj = Tensor()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Obs
    def BirdviewImage(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from communications.isp.Tensor import Tensor
            obj = Tensor()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Obs
    def Command(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Obs
    def CompactVector(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from communications.isp.Tensor import Tensor
            obj = Tensor()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Obs
    def PrevAction(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            x = o + self._tab.Pos
            from communications.isp.Action import Action
            obj = Action()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Obs
    def SensorData(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from communications.isp.SensorsDataDict import SensorsDataDict
            obj = SensorsDataDict()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

def ObsStart(builder): builder.StartObject(9)
def Start(builder):
    return ObsStart(builder)
def ObsAddEgoLocation(builder, egoLocation): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(egoLocation), 0)
def AddEgoLocation(builder, egoLocation):
    return ObsAddEgoLocation(builder, egoLocation)
def ObsAddEgoRotation(builder, egoRotation): builder.PrependStructSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(egoRotation), 0)
def AddEgoRotation(builder, egoRotation):
    return ObsAddEgoRotation(builder, egoRotation)
def ObsAddSpeed(builder, speed): builder.PrependFloat64Slot(2, speed, 0.0)
def AddSpeed(builder, speed):
    return ObsAddSpeed(builder, speed)
def ObsAddFrontImage(builder, frontImage): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(frontImage), 0)
def AddFrontImage(builder, frontImage):
    return ObsAddFrontImage(builder, frontImage)
def ObsAddBirdviewImage(builder, birdviewImage): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(birdviewImage), 0)
def AddBirdviewImage(builder, birdviewImage):
    return ObsAddBirdviewImage(builder, birdviewImage)
def ObsAddCommand(builder, command): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(command), 0)
def AddCommand(builder, command):
    return ObsAddCommand(builder, command)
def ObsAddCompactVector(builder, compactVector): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(compactVector), 0)
def AddCompactVector(builder, compactVector):
    return ObsAddCompactVector(builder, compactVector)
def ObsAddPrevAction(builder, prevAction): builder.PrependStructSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(prevAction), 0)
def AddPrevAction(builder, prevAction):
    return ObsAddPrevAction(builder, prevAction)
def ObsAddSensorData(builder, sensorData): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(sensorData), 0)
def AddSensorData(builder, sensorData):
    return ObsAddSensorData(builder, sensorData)
def ObsEnd(builder): return builder.EndObject()
def End(builder):
    return ObsEnd(builder)