Package me.autobot.lib.odometry
Class SimpleOdometry2d
java.lang.Object
me.autobot.lib.odometry.SimpleOdometry2d
A simple 2D odometry object that can be used to track the position and rotation of an object.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty odometry object with a position and rotation of 0.SimpleOdometry2d
(Vector2d position, Rotation2d rotation) Creates an odometry object with a given position and rotation. -
Method Summary
Modifier and TypeMethodDescriptionGets the current position of the odometry object.Gets the current rotation of the odometry object.void
Moves the odometry object by a given movement.reset()
Resets the odometry object to the starting position and rotation.void
rotate
(Rotation2d rotation) Rotates the odometry object by a given rotation.setStartPosition
(Vector2d startPosition) Sets the starting position of the odometry object.setStartRotation
(Rotation2d startRotation) Sets the starting rotation of the odometry object.
-
Constructor Details
-
SimpleOdometry2d
public SimpleOdometry2d()Creates an empty odometry object with a position and rotation of 0. -
SimpleOdometry2d
Creates an odometry object with a given position and rotation.- Parameters:
position
- The position of the odometry object.rotation
- The rotation of the odometry object.
-
-
Method Details
-
setStartPosition
Sets the starting position of the odometry object.- Parameters:
startPosition
- The starting position of the odometry object. This is useful for resetting the odometry object.- Returns:
- The odometry object.
- See Also:
-
setStartRotation
Sets the starting rotation of the odometry object.- Parameters:
startRotation
- The starting rotation of the odometry object. This is useful for resetting the odometry object.- Returns:
- The odometry object.
- See Also:
-
reset
Resets the odometry object to the starting position and rotation.- Returns:
- The odometry object.
-
getPosition
Gets the current position of the odometry object.- Returns:
- The current position of the odometry object.
-
getRotation
Gets the current rotation of the odometry object.- Returns:
- The current rotation of the odometry object.
-
rotate
Rotates the odometry object by a given rotation.- Parameters:
rotation
- The rotation to rotate the odometry object by.
-
move
Moves the odometry object by a given movement.- Parameters:
movement
- The movement to move the odometry object by.
-