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

Aviv elbow #7

Open
wants to merge 13 commits into
base: on-robot
Choose a base branch
from
Open

Aviv elbow #7

wants to merge 13 commits into from

Conversation

hillelv
Copy link

@hillelv hillelv commented Aug 4, 2024

create an elbow with move to angle function

@YHerm YHerm changed the base branch from master to on-robot August 4, 2024 13:58
src/main/java/training/Robot.java Outdated Show resolved Hide resolved
Comment on lines +19 to +22
keyboardController.A.onTrue(elbow.getCommmands().moveToPosition(Rotation2d.fromDegrees(0)));
keyboardController.W.onTrue(elbow.getCommmands().moveToPosition(Rotation2d.fromDegrees(324)));
keyboardController.D.onTrue(elbow.getCommmands().moveToPosition(Rotation2d.fromDegrees(20)));
keyboardController.S.onTrue(elbow.getCommmands().moveToPosition(Rotation2d.fromDegrees(80)));

Choose a reason for hiding this comment

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

magic numbers

Choose a reason for hiding this comment

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

meant for testing bruh

}


Choose a reason for hiding this comment

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

delete


static final double KV = 0;

static final double BATTERY_VOLTAGE = 12;

Choose a reason for hiding this comment

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

this isnt only for elbow.. put this in simulation constants

Copy link
Collaborator

Choose a reason for hiding this comment

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

Put in Global constants and name it Deafult battery voltage

Comment on lines +16 to +18
private CommandsBuilder commmands;
private IElbow iElbow;

Choose a reason for hiding this comment

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

put these before the functions and delete the extra space line

elbowSimulation.setInputVoltage(limited_voltage);
}


Choose a reason for hiding this comment

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

extra line...

}

}

Choose a reason for hiding this comment

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

delete

Choose a reason for hiding this comment

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

add the measurement unit to the name of the constants that need it (like ARM_LENGTH_METERS)

Comment on lines +43 to +45
public static final Pair<
Rotation2d,
Rotation2d> SHOOTER_COLLISION_RANGE = new Pair<>(BACKWARD_ANGLE_LIMIT, PresetPositions.SAFE.ANGLE);

Choose a reason for hiding this comment

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

fix the spacing

public static final double FULL_CIRCLE_RAD = 2 * Math.PI;;

}

Choose a reason for hiding this comment

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

delete this line

Copy link

@greenblitz4590 greenblitz4590 left a comment

Choose a reason for hiding this comment

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

Romy - greate job, mostly small requests and spaces


public class TrainingRobotManager extends DefaultRobotManager {

private Robot robot;
private KeyboardController keyboardController;
private Elbow elbow;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Create in robot , also the bindings

protected void subsystemPeriodic() {}

private CommandsBuilder commmands;
private IElbow iElbow;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Final sweety

}

public CommandsBuilder getCommmands() {
return this.commmands;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this


public NEOElbow() {
this.motor = new CANSparkMax(Constants.MOTOR_ID, CANSparkLowLevel.MotorType.kBrushless);
motor.getEncoder().setPositionConversionFactor(Constants.GEAR_RATIO);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Set velocity factor too


public static final double GEAR_RATIO = 1 / (28.0 * (60.0 / 16.0));

public static final Rotation2d TOLERANCE = Rotation2d.fromDegrees(3);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be in elbow constants

import edu.wpi.first.math.geometry.Translation3d;
import edu.wpi.first.math.controller.PIDController;

public class SimulationElbowConstants {
Copy link
Collaborator

Choose a reason for hiding this comment

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

A lot of constants here are not type dependent, move them into elbow simulation

import edu.wpi.first.math.system.plant.DCMotor;

public class SimulationElbow implements IElbow {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Use single jointed arm simulation instead

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.

5 participants