# automatically generated by the FlatBuffers compiler, do not modify

# namespace: FBOutput

import tdw.flatbuffers

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

    @classmethod
    def GetRootAsJointDrive(cls, buf, offset):
        n = tdw.flatbuffers.encode.Get(tdw.flatbuffers.packer.uoffset, buf, offset)
        x = JointDrive()
        x.Init(buf, n + offset)
        return x

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

    # JointDrive
    def Limits(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return bool(self._tab.Get(tdw.flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

    # JointDrive
    def LowerLimit(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(tdw.flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # JointDrive
    def UpperLimit(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(tdw.flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # JointDrive
    def Stiffness(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(tdw.flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # JointDrive
    def Damping(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(tdw.flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # JointDrive
    def ForceLimit(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(tdw.flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # JointDrive
    def Axis(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(tdw.flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 1

def JointDriveStart(builder): builder.StartObject(7)
def JointDriveAddLimits(builder, limits): builder.PrependBoolSlot(0, limits, 0)
def JointDriveAddLowerLimit(builder, lowerLimit): builder.PrependFloat32Slot(1, lowerLimit, 0.0)
def JointDriveAddUpperLimit(builder, upperLimit): builder.PrependFloat32Slot(2, upperLimit, 0.0)
def JointDriveAddStiffness(builder, stiffness): builder.PrependFloat32Slot(3, stiffness, 0.0)
def JointDriveAddDamping(builder, damping): builder.PrependFloat32Slot(4, damping, 0.0)
def JointDriveAddForceLimit(builder, forceLimit): builder.PrependFloat32Slot(5, forceLimit, 0.0)
def JointDriveAddAxis(builder, axis): builder.PrependUint8Slot(6, axis, 1)
def JointDriveEnd(builder): return builder.EndObject()
