Skip to content

Initial implementation of ArmPID subsystem - #5

Open
alarichunz wants to merge 3 commits into
flipside_2018from
ArmPID
Open

Initial implementation of ArmPID subsystem#5
alarichunz wants to merge 3 commits into
flipside_2018from
ArmPID

Conversation

@alarichunz

Copy link
Copy Markdown
Contributor
  • Create the ArmPID subsystem file
  • Add potentiometer to RobotMap
  • Lower MaxArmSpeed to 0.75

@alarichunz alarichunz self-assigned this Feb 2, 2019
@alarichunz
alarichunz requested a review from pvu-github February 2, 2019 21:52

@pvu-github pvu-github left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall this is a great start. You need to plumb the rest of the lower-level functions in this Subsystem class to control the motor for the arm.

Also, you need to 1) create the commands for controlling the arm and 2) set the OI button mapping to commands.

Comment thread src/main/java/frc/robot/RobotMap.java Outdated
/* TODO: Add digital sensors (ultrasonic/limit switch) from other subsystems */

/* Analog ports */
public static int potentiometer = 3;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename to specify what this potentiometer belongs to. (e.g. m_armPot)

public ArmPID() {

// Intert a subsystem name and PID values here
super("ArmPID", 1, 2, 3);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure the 1, 2, 3 refers to the P, I, and D values respectively.
Please create PID constants and use them instead of hardcoding them here

// e.g. yourMotor.set(output);
}

public void set (double output) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Coding style - Remove extra spaces between the method name and the "()" for the arguments.

this.output = output;
}

public int index() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rename to "getIndex()" for clarity


public double zeroPoint = 0;

private int index = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a comment to describe that this index reflects the setpoints for the arm.

public double zeroPoint = 0;

private int index = 0;
public double output = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems output and target aren't used in your code. These variables are likely used for setting the motor "output" and the "target" encoder position for your PID control loop to adjust the motor speeds to maintain those preset positions.

I'd suggest renaming these variables to be more clear once we figure out what they are supposed to do.

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.

2 participants