Package lejos.robotics.chassis
Class WheeledChassis.Modeler
- java.lang.Object
-
- lejos.robotics.chassis.WheeledChassis.Modeler
-
- All Implemented Interfaces:
Wheel
- Enclosing class:
- WheeledChassis
public static class WheeledChassis.Modeler extends java.lang.Object implements Wheel
The Modeler class helps to model a wheel. Wheel attributes can be modeled using methods.- offset() specifes the location of the wheel along the y-axis
- gearRatio() specifes 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
-
-
Constructor Summary
Constructors Constructor Description Modeler(RegulatedMotor motor, double diameter)Creates a modeler object to model a robot wheel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WheeledChassis.ModelergearRatio(double val)Defines the gear train between motor and wheel.MatrixgetFactors()Returns the x,y and r factors to calculate motor speed from wheel linear and angular speed.RegulatedMotorgetMotor()WheeledChassis.Modelerinvert(boolean val)Inverts the motor directionWheeledChassis.Modeleroffset(double val)Defines the offset off the wheel
-
-
-
Field Detail
-
motor
protected RegulatedMotor motor
-
diameter
protected double diameter
-
gearRatio
protected double gearRatio
-
offset
protected double offset
-
angle
protected double angle
-
invert
protected boolean invert
-
-
Constructor Detail
-
Modeler
public Modeler(RegulatedMotor motor, double diameter)
Creates a modeler object to model a robot wheel- Parameters:
motor- The regulated motor that drives the wheeldiameter- The diameter of the wheel (Lego wheels have the diameter printed on the side)
-
-
Method Detail
-
offset
public WheeledChassis.Modeler offset(double val)
Defines the offset off the wheel- Parameters:
val- The distance between the robots yPose-axis and the center of the wheel- Returns:
- the modeler
-
gearRatio
public WheeledChassis.Modeler gearRatio(double val)
Defines the gear train between motor and wheel.- Parameters:
val- The ratio between wheel speed and motor speed- Returns:
- the modeler
-
invert
public WheeledChassis.Modeler invert(boolean val)
Inverts the motor direction- Parameters:
val-- Returns:
- the modeler
-
getFactors
public Matrix getFactors()
Description copied from interface:WheelReturns 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:
getFactorsin interfaceWheel- Returns:
- the factors as a matrix
-
getMotor
public RegulatedMotor getMotor()
-
-