Class TrcOdometryWheels
Configuration 1: This configuration has 2 sensors: one for Y-axis and one for rotation. The Y-axis sensor is most likely an encoder on passive omni-wheels installed parallel to the Y-axis. The angle sensor is most likely a gyro. This configuration does not support holonomic drive base since it doesn't provide X odometry. The Y sensor is typically installed inline with either the left or the right wheels and tangential to the centroid of the drive base.
Configuration 2: This configuration has 3 sensors: one for X-axis, one for Y-axis and one for rotation. The X and Y sensors are most likely encoders on passive omni-wheels installed parallel to the X and Y axes respectively. The angle sensor is most likely a gyro. This configuration can support holonomic drive base. The Y sensor is typically installed inline with either the left or the right wheels and tangential to the drive base centroid. The X sensor is typically installed on the front or the back of the drive base tangential to the centroid of the drive base.
Configuration 3: This configuration also has 3 sensors: two for Y-axis and one for rotation. The Y sensors are most likely encoders on passive omni-wheels installed parallel to the Y axis. The angle sensor is most likely a gyro. This configuration does not support holonomic drive base since it doesn't provide X odometry. The two Y sensors are typically installed on the left and right sides of the drive base equidistant to the centroid most likely inline with the left and right wheels and tangential to the centroid of the drive base.
Configuration 4: This configuration has 4 sensors: one for X-axis, two for Y-axis and one for rotation. The three axes sensors are most likely encoders on passive omni-wheels installed parallel to the X and Y axes respectively. The angle sensor is most likely a gyro. This configuration can support holonomic drive base. The two Y sensors are typically installed on the left and right sides of the drive base equidistant to the centroid most likely inline with the left and right wheels and tangential to the centroid of the drive base. The X sensor is typically installed on the front or the back of the drive base and tangential to the centroid of the drive base.
Configuration 5: This configuration has 5 sensors: two for X-axis, two for Y-axis and one for rotation. The four axes sensors are most likely encoders on passive omni-wheels installed parallel to the X and Y axes respectively. The angle sensor is most likely a gyro. This configuration can support holonmic drive base. The two Y sensors are typically installed on the left and right sides of the drive base equidistant to the centroid most likely inline with the left and right wheels and tangential to the centroid of the drive base. The two X sensors are typically installed on the front or the back of the drive base equidistant to the centroid and tangential to the centroid of the drive base.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class encapsulates an axis sensor with its axis offset. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TrcOdometrySensor.Odometry
private double
private final TrcOdometrySensor
private final String
private double
private double
final TrcDbgTrace
private double
private final TrcOdometryWheels.AxisSensor[]
private double
private final TrcOdometryWheels.AxisSensor[]
-
Constructor Summary
ConstructorsConstructorDescriptionTrcOdometryWheels
(TrcOdometryWheels.AxisSensor[] ySensors, TrcOdometrySensor angleSensor) Constructor: Create an instance of the object.TrcOdometryWheels
(TrcOdometryWheels.AxisSensor[] xSensors, TrcOdometryWheels.AxisSensor[] ySensors, TrcOdometrySensor angleSensor) Constructor: Create an instance of the object.TrcOdometryWheels
(TrcOdometryWheels.AxisSensor ySensor, TrcOdometrySensor angleSensor) Constructor: Create an instance of the object.TrcOdometryWheels
(TrcOdometryWheels.AxisSensor xSensor, TrcOdometryWheels.AxisSensor[] ySensors, TrcOdometrySensor angleSensor) Constructor: Create an instance of the object.TrcOdometryWheels
(TrcOdometryWheels.AxisSensor xSensor, TrcOdometryWheels.AxisSensor ySensor, TrcOdometrySensor angleSensor) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionprivate double
averageSensorValues
(TrcOdometryWheels.AxisSensor[] axisSensors, double scale, boolean position) This method calculates the average of either position or velocity odometry data of all sensors in the given axis.This method reads all the sensors and calculates the delta displacement from the last odometry update.boolean
isSensorUsed
(TrcOdometrySensor sensor) This method checks if the given sensor is used as part of the Odometry sensors.void
resetOdometry
(boolean resetPositionOdometry, boolean resetHeadingOdometry, boolean resetHardware) This method resets the odometry device and data.void
setOdometryScales
(double xScale, double yScale) This method sets the scaling factors for Y and angle data.void
setOdometryScales
(double xScale, double yScale, double angleScale) This method sets the scaling factors for both X, Y and angle data.private void
updateAxisOdometries
(TrcOdometryWheels.AxisSensor[] axisSensors) This method is called to update the odometry data for all sensors of the given axis.
-
Field Details
-
moduleName
-
tracer
-
xSensors
-
ySensors
-
angleSensor
-
angleOdometry
-
xScale
private double xScale -
yScale
private double yScale -
angleScale
private double angleScale -
prevAvgXPos
private double prevAvgXPos -
prevAvgYPos
private double prevAvgYPos
-
-
Constructor Details
-
TrcOdometryWheels
public TrcOdometryWheels(TrcOdometryWheels.AxisSensor[] xSensors, TrcOdometryWheels.AxisSensor[] ySensors, TrcOdometrySensor angleSensor) Constructor: Create an instance of the object. This is typically used for configuration 5.- Parameters:
xSensors
- specifies an array of Odometry sensors for the X-axis.ySensors
- specifies an array of Odometry sensors for the Y-axis.angleSensor
- specifies the Odometry sensor for rotation.
-
TrcOdometryWheels
public TrcOdometryWheels(TrcOdometryWheels.AxisSensor xSensor, TrcOdometryWheels.AxisSensor[] ySensors, TrcOdometrySensor angleSensor) Constructor: Create an instance of the object. This is typically used for configuration 4.- Parameters:
xSensor
- specifies an Odometry sensors for the X-axis.ySensors
- specifies an array of Odometry sensors for the Y-axis.angleSensor
- specifies the Odometry sensor for rotation.
-
TrcOdometryWheels
Constructor: Create an instance of the object. This is typically used for configuration 3.- Parameters:
ySensors
- specifies an array of Odometry sensors for the Y-axis.angleSensor
- specifies the Odometry sensor for rotation.
-
TrcOdometryWheels
public TrcOdometryWheels(TrcOdometryWheels.AxisSensor xSensor, TrcOdometryWheels.AxisSensor ySensor, TrcOdometrySensor angleSensor) Constructor: Create an instance of the object. This is typically use for configuration 2.- Parameters:
xSensor
- specifies an Odometry sensors for the X-axis.ySensor
- specifies an Odometry sensors for the Y-axis.angleSensor
- specifies the Odometry sensor for rotation.
-
TrcOdometryWheels
Constructor: Create an instance of the object. This is typically use for configuration 1.- Parameters:
ySensor
- specifies an Odometry sensors for the Y-axis.angleSensor
- specifies the Odometry sensor for rotation.
-
-
Method Details
-
isSensorUsed
This method checks if the given sensor is used as part of the Odometry sensors.- Parameters:
sensor
- specifies the sensor to be checked.- Returns:
- true if the sensor is part of the odometry sensors, false otherwise.
-
setOdometryScales
public void setOdometryScales(double xScale, double yScale, double angleScale) This method sets the scaling factors for both X, Y and angle data. This is typically used to scale encoder counts to physical units such as inches. If the scale of a direction is not provided, it must be set to 1.0.- Parameters:
xScale
- specifies the scale factor for the X direction.yScale
- specifies the scale factor for the Y direction.angleScale
- specifies the scale factor the the angle.
-
setOdometryScales
public void setOdometryScales(double xScale, double yScale) This method sets the scaling factors for Y and angle data. This is typically used to scale encoder counts to physical units such as inches. If the scale of a direction is not provided, it must be set to 1.0.- Parameters:
xScale
- specifies the scale factor for the X direction.yScale
- specifies the scale factor for the Y direction.
-
resetOdometry
public void resetOdometry(boolean resetPositionOdometry, boolean resetHeadingOdometry, boolean resetHardware) This method resets the odometry device and data.- Parameters:
resetPositionOdometry
- specifies true for resetting position odometry, false otherwise. Generally, this should be set to true unless the position odometry has been reset somewhere else.resetHeadingOdometry
- specifies true to also reset the heading odometry, false otherwise.resetHardware
- specifies true to do a hardware reset, false to do a soft reset.
-
getOdometryDelta
This method reads all the sensors and calculates the delta displacement from the last odometry update. Only position data are deltas but not velocities because we only integrate position data into absolute field position.- Returns:
- delta odometry.
-
updateAxisOdometries
This method is called to update the odometry data for all sensors of the given axis.- Parameters:
axisSensors
- specifies the axis sensor array to be updated.
-
averageSensorValues
private double averageSensorValues(TrcOdometryWheels.AxisSensor[] axisSensors, double scale, boolean position) This method calculates the average of either position or velocity odometry data of all sensors in the given axis.- Parameters:
axisSensors
- specifies the axis sensor array to be averaged.scale
- specifies the odometry sensor scale.position
- specifies true to average position data, false to average velocity data.- Returns:
- averaged value.
-