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

Using Elbow IMU #33

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Using Elbow IMU #33

wants to merge 3 commits into from

Conversation

katiewang22
Copy link
Member

No description provided.

RobotMap.leftElbowMotor.set(TalonFXControlMode.Position, elbow);

// TODO: figure out if reading pitch or roll
elbowCommand = controller.calculate(RobotMap.elbowIMU.getRoll(), elbow);

Choose a reason for hiding this comment

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

This is not going to work. Previously we were sending down a target to the motor PID and the Motor PID was calculating the motor output every loop. Now we need to do this calculation loop ourselves. This function should only set the target of the PID, and then the PID calculation needs to occur every loop. Best way I can see of doing this is to make a periodic function in this class and call it in the overall robot periodic function. Also I am not sure how follower mode works, but we might need to set the power for both elbow motors instead of just one.

Math.abs(RobotMap.leftElbowMotor.getSelectedSensorPosition() - elbowTarget) <= Math.abs(allowance)) {
public static Boolean getArrived(double shoulderAllowance, double elbowAllowance, double time) {
if (Math.abs(RobotMap.leftShoulderMotor.getSelectedSensorPosition() - shoulderTarget) <= Math.abs(shoulderAllowance) &&
Math.abs(RobotMap.leftElbowMotor.getSelectedSensorPosition() - elbowTarget) <= Math.abs(elbowAllowance)) {

Choose a reason for hiding this comment

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

We are not using the internal motor encoder for position anymore, we are using the gyro. The sensor reading call needs to reflect that.

RobotMap.leftElbowMotor.set(TalonFXControlMode.Position, Constants.ELBOW_IDLE.ELBOW_POSITION);

// TODO: figure out if reading pitch or roll
elbowCommand = controller.calculate(RobotMap.elbowIMU.getRoll(), Constants.ELBOW_IDLE.ELBOW_POSITION);

Choose a reason for hiding this comment

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

Same as the function below

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