|
| 1 | +# How to make swerve |
| 2 | +## First: make a swerve object using this code with a constructor: |
| 3 | +```public SwerveBase(SwerveDriveKinematics kinematics, Matrix<N3, N1> stateStdDevs, Matrix<N3, N1> visionMeasurementDevs, SwerveModuleConfig... configs)``` |
| 4 | +- SwerveDriveKinematics: Convert robot speed into individual module speed |
| 5 | +- statesStdDevs: Room for error for your modules |
| 6 | +- visionMeasurementDevs: The room for error in your vision measurements |
| 7 | +- SwerveModuleConfig: Defines swerve modules |
| 8 | + |
| 9 | + |
| 10 | +## Some of the things you can do with this swerve code are: |
| 11 | +- drive: Takes in a variety of parameters to get where you need to go |
| 12 | +- assign: Takes in Chassis velocity and converts robot speed to individual module speed |
| 13 | +- stop: Stops movement of the robot |
| 14 | +- setBrakeMode: Sets each module into brake mode |
| 15 | +- setDriveVoltage: Sets each module to specified voltage |
| 16 | +- getPose: Returns the position of the robot |
| 17 | +- getTranslation: Returns translation of the robot's position |
| 18 | +- getRawEstimatedPose: returns estimated position of the robot |
| 19 | +- addVisionMeasurement: Logs the position of the robot at a given time for vision |
| 20 | +- resetEncoders: sets the value of the encoders to be default value |
| 21 | +- resetOdometry: resets the value of the odometry to default position |
| 22 | +- getStates: gets the status of each swerve module |
| 23 | +- getPositions: returns the positions of each swerve module |
| 24 | +- setModuleStates: sets how much each module is turned and their velocities |
| 25 | +- periodic: updates log of the robots position and logs estimated position |
| 26 | +- resetAll: Resets odometry, encoders, and gyro to zero |
| 27 | +- xLock: sets the robot to turn wheels to all face inward to center of robot |
| 28 | +- oLock: sets the direction of all wheels for broad sides to face inward to center |
| 29 | +- zeroLock: sets all wheels straight |
| 30 | +- characterize: uses System identification to use PID |
| 31 | +- getGyroRotation2d: returns the rotation of the robot in degrees |
| 32 | +- resetGyro: resets the value of the gyro to default reset value |
| 33 | +- getFieldVelocity: converts the velocity of each of the modules to the chassis speed and returns the value |
| 34 | +- getRobotVelocity: uses the speeds of each of the modules to return the chassis speed |
| 35 | +- getSpeed: returns the speed of the robot |
| 36 | +- getModule: Uses the module number to return the module |
| 37 | +- getPredictedPose: returns the estimated position of the robot |
| 38 | +- getDisplacementTo: returns the value of the robot's change in position to get to a certain point |
| 39 | +- getDistanceTo: returns the distance needed to travel to a specific point |
| 40 | +- getAngularDisplacementTo: returns the change in the robot's angular positon to get to a certain point or angle |
| 41 | +- getAngleTo: bounds the change in angle between -pi and pi |
| 42 | +- nearestPose2d: returns the nearest postion of the robot within a set of points |
| 43 | +- nearestTranslation2d: returns the nearest translation of the robot with a set of translations |
| 44 | +- identifyOffsetsCommand: identify the angle that the robot has been offset |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +# NOTE: This is just a template and is meant to be adjusted to individual needs |
0 commit comments