Updated to include gyro and accelerometer, and Rotation3d offset.

This commit is contained in:
thenetworkgrinch
2023-03-06 20:45:54 -06:00
parent 9b78c6363f
commit 5fd00878d2
120 changed files with 994 additions and 312 deletions

View File

@@ -3,8 +3,10 @@ package swervelib.simulation;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Rotation3d;
import edu.wpi.first.math.geometry.Translation3d;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.Field2d;
import java.util.Optional;
import swervelib.math.SwerveKinematics2;
import swervelib.math.SwerveModuleState2;
@@ -77,6 +79,16 @@ public class SwerveIMUSimulation
return new Rotation3d(0, 0, angle);
}
/**
* Fetch the acceleration [x, y, z] from the IMU in m/s/s. If acceleration isn't supported returns empty.
*
* @return {@link Translation3d} of the acceleration as an {@link Optional}.
*/
public Optional<Translation3d> getAccel()
{
return Optional.empty();
}
/**
* Update the odometry of the simulated {@link swervelib.SwerveDrive} and post the {@link swervelib.SwerveModule}
* states to the {@link Field2d}.