How to use the pyfrc.physics.units.units.meters.m_from function in pyfrc

To help you get started, we’ve selected a few pyfrc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github robotpy / pyfrc / pyfrc / physics / drivetrains.py View on Github external
def __init__(
        self,
        x_wheelbase: units.Quantity = 2 * units.feet,
        y_wheelbase: units.Quantity = 3 * units.feet,
        speed: units.Quantity = 5 * units.fps,
        deadzone: typing.Optional[DeadzoneCallable] = None,
    ):
        """
            :param x_wheelbase: The distance between right and left wheels.
            :param y_wheelbase: The distance between forward and rear wheels.
            :param speed:       Speed of robot (see above)
            :param deadzone:    A function that adjusts the output of the motor (see :func:`linear_deadzone`)
        """
        x2 = units.meters.m_from(x_wheelbase, name="x_wheelbase") / 2.0
        y2 = units.meters.m_from(y_wheelbase, name="y_wheelbase") / 2.0

        self.kinematics = MecanumDriveKinematics(
            Translation2d(x2, y2),
            Translation2d(x2, -y2),
            Translation2d(-x2, y2),
            Translation2d(-x2, -y2),
        )

        self.speed = units.mps.m_from(speed, name="speed")
        self.deadzone = deadzone

        self.wheelSpeeds = MecanumDriveWheelSpeeds()
github robotpy / pyfrc / pyfrc / physics / drivetrains.py View on Github external
def __init__(
        self,
        x_wheelbase: units.Quantity = 2 * units.feet,
        speed: units.Quantity = 5 * units.fps,
        deadzone: typing.Optional[DeadzoneCallable] = None,
    ):
        """
            :param x_wheelbase: The distance between right and left wheels.
            :param speed:       Speed of robot (see above)
            :param deadzone:    A function that adjusts the output of the motor (see :func:`linear_deadzone`)
        """
        trackwidth = units.meters.m_from(x_wheelbase, name="x_wheelbase")
        self.kinematics = DifferentialDriveKinematics(trackwidth)
        self.speed = units.mps.m_from(speed, name="speed")
        self.wheelSpeeds = DifferentialDriveWheelSpeeds()
        self.deadzone = deadzone
github robotpy / pyfrc / pyfrc / physics / drivetrains.py View on Github external
def __init__(
        self,
        x_wheelbase: units.Quantity = 2 * units.feet,
        y_wheelbase: units.Quantity = 3 * units.feet,
        speed: units.Quantity = 5 * units.fps,
        deadzone: typing.Optional[DeadzoneCallable] = None,
    ):
        """
            :param x_wheelbase: The distance between right and left wheels.
            :param y_wheelbase: The distance between forward and rear wheels.
            :param speed:       Speed of robot (see above)
            :param deadzone:    A function that adjusts the output of the motor (see :func:`linear_deadzone`)
        """
        x2 = units.meters.m_from(x_wheelbase, name="x_wheelbase") / 2.0
        y2 = units.meters.m_from(y_wheelbase, name="y_wheelbase") / 2.0

        self.kinematics = MecanumDriveKinematics(
            Translation2d(x2, y2),
            Translation2d(x2, -y2),
            Translation2d(-x2, y2),
            Translation2d(-x2, -y2),
        )

        self.speed = units.mps.m_from(speed, name="speed")
        self.deadzone = deadzone

        self.wheelSpeeds = MecanumDriveWheelSpeeds()