Skip to content

Conversation

@orira22
Copy link
Contributor

@orira22 orira22 commented Jan 8, 2025

No description provided.

Copy link
Contributor Author

@orira22 orira22 left a comment

Choose a reason for hiding this comment

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

Overall the code is good
Need to define some constants and fix documentation


/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */
public class PivotMoveToAngle extends Command {
public Pivot myPivot;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instance should be private


/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */
public class PivotMoveWithJoystick extends Command {
public Pivot myPivot;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instance should be private

public class PivotMoveWithJoystick extends Command {
public Pivot myPivot;

private DoubleSupplier _double_Supplier;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change instance name to camel case


private DoubleSupplier _double_Supplier;

public PivotMoveWithJoystick(DoubleSupplier Double_Supplier)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change parameter name to camel case


private static Pivot instance = null;

public double tolerance = 2.0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Define in constants file


private Pivot()
{
motor = new SparkFlex(1, MotorType.kBrushless);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Define motor ID in constants file

}

/***
* The function moves the motor to the wanted angle
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moves the pivot to the wanted angle :)

closedLoopController.setReference(angle, ControlType.kMAXMotionPositionControl,ClosedLoopSlot.kSlot0);
}

public void SetPower(double power)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function name should start with little letter

motor.set(power);
}

public void StopMotor()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function name should start with little letter

}

/***
* The function checks if the motor has reached the wanted angle
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the pivot*

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