Class WheeledChassis.HolonomicModeler

  • All Implemented Interfaces:
    Wheel
    Enclosing class:
    WheeledChassis

    public static class WheeledChassis.HolonomicModeler
    extends java.lang.Object
    implements Wheel
    The Modeler class helps to model a wheel. Wheel attributes can be modeled using methods.
    • polarPosition() specifies the location of the wheel
    • gearRatio() specifies the gear ratio of the gear train between motor and wheel
    • invert() inverts the direction of the motor. Equivalent to a negative gearing

    Author:
    Aswin Bouwmeester
    • Field Detail

      • diameter

        protected double diameter
      • gearRatio

        protected double gearRatio
      • offset

        protected double offset
      • pose

        protected Pose pose
      • invert

        protected boolean invert
    • Constructor Detail

      • HolonomicModeler

        public HolonomicModeler​(RegulatedMotor motor,
                                double diameter)
        Creates a modeler object to model a robot wheel
        Parameters:
        motor - The regulated motor that drives the wheel
        diameter - The diameter of the wheel (Lego wheels have the diameter printed on the side)
    • Method Detail

      • polarPosition

        public WheeledChassis.HolonomicModeler polarPosition​(double angle,
                                                             double radius)
        Specifies the location and orientation of the wheel using polar coordinates

        Use this method only when the wheel axis points to the center of the robot.

        Parameters:
        angle - Angle between wheel axis and the robots x-axis
        radius - Distance between center of the wheel and center of the robot
        Returns:
        the modeler
      • cartesianPosition

        public WheeledChassis.HolonomicModeler cartesianPosition​(double x,
                                                                 double y,
                                                                 double angle)
        Specifies the location and orientation of the wheel using a cartesian coordinates

        Parameters:
        x - X-position of the center of the wheel in respect to the robots origin
        y - Y-position of the center of the wheel in respect to the robots origin
        angle - Angle between the driving direction of the wheel and the robots x-axis
        Returns:
        the modeler
      • gearRatio

        public WheeledChassis.HolonomicModeler gearRatio​(double val)
        Defines the gear train between motor and wheel.
        Parameters:
        val - The ratio between wheel speed and motor speed. A ratio greater than 1 means the wheel turns faster than the motor.
        Returns:
        the modeler
      • getFactors

        public Matrix getFactors()
        Description copied from interface: Wheel
        Returns the x,y and r factors to calculate motor speed from wheel linear and angular speed.

        The factors form the row of a forward matrix

        Specified by:
        getFactors in interface Wheel
        Returns:
        the factors as a matrix