Package frc.team88.swerve.motion.state
Class OdomState
- java.lang.Object
-
- frc.team88.swerve.motion.state.OdomState
-
- All Implemented Interfaces:
NetworkTablePopulator
public class OdomState extends java.lang.Object implements NetworkTablePopulator
Represents the state of the robot as determined by the odometry, both position and velocity.
-
-
Constructor Summary
Constructors Constructor Description OdomState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addToPosition(double x, double y)
Adds the given values to the position.void
addToTheta(double theta)
Adds the given value the heading.double
getTheta()
Gets the heading.double
getThetaVelocity()
Gets the heading angular velocity.double
getXPosition()
Gets the x position.double
getXVelocity()
Gets the x velocity.double
getYPosition()
Gets the y position.double
getYVelocity()
Gets the y velocity.void
populateNetworkTable(edu.wpi.first.networktables.NetworkTable table)
Populates the given network table with data from this class.void
setPosition(double x, double y)
Sets the position.void
setTheta(double theta)
Sets the heading.void
setThetaVelocity(double vtheta)
Sets the heading angular velocity.void
setVelocity(double vx, double vy)
Sets the velocity.
-
-
-
Method Detail
-
getXPosition
public double getXPosition()
Gets the x position.- Returns:
- The x position, in feet.
-
getYPosition
public double getYPosition()
Gets the y position.- Returns:
- The y position, in feet.
-
setPosition
public void setPosition(double x, double y)
Sets the position.- Parameters:
x
- The x positon, in feet.y
- The y position, in feet.
-
addToPosition
public void addToPosition(double x, double y)
Adds the given values to the position.- Parameters:
x
- The x positon to add, in feet.y
- The y position to add, in feet.
-
getTheta
public double getTheta()
Gets the heading.- Returns:
- The heading, in degrees.
-
setTheta
public void setTheta(double theta)
Sets the heading.- Parameters:
theta
- The heading, in degrees.
-
addToTheta
public void addToTheta(double theta)
Adds the given value the heading.- Parameters:
theta
- The heading to add, in degrees.
-
getXVelocity
public double getXVelocity()
Gets the x velocity.- Returns:
- The x velocity, in feet per second.
-
getYVelocity
public double getYVelocity()
Gets the y velocity.- Returns:
- The y velocity, in feet per second.
-
setVelocity
public void setVelocity(double vx, double vy)
Sets the velocity.- Parameters:
vx
- The x velocity, in feet per second.vy
- The y velocity, in feet per second.
-
getThetaVelocity
public double getThetaVelocity()
Gets the heading angular velocity.- Returns:
- The heading angular velocity, in degrees per second.
-
setThetaVelocity
public void setThetaVelocity(double vtheta)
Sets the heading angular velocity.- Parameters:
vtheta
- The heading angular velocity, in degrees per second.
-
populateNetworkTable
public void populateNetworkTable(edu.wpi.first.networktables.NetworkTable table)
Description copied from interface:NetworkTablePopulator
Populates the given network table with data from this class. May also read in values.- Specified by:
populateNetworkTable
in interfaceNetworkTablePopulator
- Parameters:
table
- The table to populate, and possibly read from.
-
-