Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update swerve code #66

Open
wants to merge 20 commits into
base: swerve
Choose a base branch
from
Open

Update swerve code #66

wants to merge 20 commits into from

Conversation

mohamed-elmashad
Copy link
Contributor

@mohamed-elmashad mohamed-elmashad commented Mar 19, 2020

Complete

  • Update 1323 lib
  • Change drivetrain to swerve
  • Change autos
  • Update robot state to use swerve odometry
  • Update auto selection
  • Update teleop to use xbox controller

In Progress

  • Clean-up


import com.team254.lib.geometry.State;

public interface ICurvature<S> extends State<S> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use 254's ICurvature

@@ -0,0 +1,9 @@
package com.team1323.lib.geometry;

public interface IPose2d<S> extends IRotation2d<S>, ITranslation2d<S> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be IUnwrappable...


// Swerve Module Wheel Offsets (Rotation encoder values when the wheels are
// facing 0 degrees)
public static final int kFrontRightEncoderStartingPos = Settings.kIsUsingCompBot ? -1403 - 1024 : 1740 - 1024;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are only going to have 1 bot, just make these constants, and leave them as zeroes with a TODO for calibration

@@ -336,6 +341,11 @@ public synchronized void updatePose(Rotation2d robotHeading){
estimatedRobotPose = robotPose;
previousEncDistance = currentEncDistance;
}

public synchronized void resetOffsetFromAbsoluteEncoder() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use: resetRotationToAbsolute


public synchronized void resetOffsetFromAbsoluteEncoder() {
double absoluteEncoderAngle = (mAbsoluteEncoder.getOutputScaleFactor() / mAbsoluteEncoder.getOutputRaw()) * 360.0;
encoderOffset += absoluteEncoderAngle;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don’t modify this, see how the original function resets the original encoder converted + encoderOffset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants