How to use the pyfrc.physics.units.units.foot.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 wpilibsuite / frc-characterization / arm_characterization / robot / robot-python-talonsrx / physics.py View on Github external
import math
from pyfrc.physics import motor_cfgs, tankmodel
from pyfrc.physics.units import units


class PhysicsEngine(object):
    """
       Simulates a 4-wheel robot using Tank Drive joystick control
    """

    WHEEL_DIAMETER = 6 * units.inch
    ENCODER_PULSE_PER_REV = 4096

    ENCODER_SCALE = units.foot.m_from(WHEEL_DIAMETER) * math.pi / ENCODER_PULSE_PER_REV

    def __init__(self, physics_controller):
        """
            :param physics_controller: `pyfrc.physics.core.Physics` object
                                       to communicate simulation effects to
        """

        self.physics_controller = physics_controller

        #
        # Two ways of initializing the realistic physics -- either use the
        # ka/kv that you computed for your robot, or use the theoretical model
        #

        # Change these parameters to fit your robot!
        # -> these parameters are for the test robot mentioned in the paper
github wpilibsuite / frc-characterization / arm_characterization / robot / robot-python-spark / physics.py View on Github external
import math
from pyfrc.physics import motor_cfgs, tankmodel
from pyfrc.physics.units import units


class PhysicsEngine(object):
    """
       Simulates a 4-wheel robot using Tank Drive joystick control
    """

    WHEEL_DIAMETER = 6 * units.inch
    ENCODER_PULSE_PER_REV = 360

    ENCODER_SCALE = units.foot.m_from(WHEEL_DIAMETER) * math.pi / 360

    def __init__(self, physics_controller):
        """
            :param physics_controller: `pyfrc.physics.core.Physics` object
                                       to communicate simulation effects to
        """

        self.physics_controller = physics_controller

        #
        # Two ways of initializing the realistic physics -- either use the
        # ka/kv that you computed for your robot, or use the theoretical model
        #

        # Change these parameters to fit your robot!
        # -> these parameters are for the test robot mentioned in the paper