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

Develop closed loop angle control for the robot using a gyro. #10

Open
pordonj opened this issue Jan 15, 2015 · 3 comments
Open

Develop closed loop angle control for the robot using a gyro. #10

pordonj opened this issue Jan 15, 2015 · 3 comments

Comments

@pordonj
Copy link
Contributor

pordonj commented Jan 15, 2015

We will want to be able to turn to specific angles in autonomous mode. Using a gyro, develop an abstraction to turn the drivetrain to a specific angle relative to the robot's current heading.

@pordonj
Copy link
Contributor Author

pordonj commented Jan 19, 2015

@SMLange @ABaade are looking into this next.

@pordonj
Copy link
Contributor Author

pordonj commented Jan 21, 2015

Comments as of 477afb8

I think you are on the right track but we need to refactor the organization. We have a few different objects and areas of concern here:

  • the Drivetrain subsystem itself, capable of driving the robot.
  • The ability to drive with joysticks via driver input.
  • The Gyro sensor that is related to the drivetrain
  • The ability to use the gyro to turn to a specific angle

We want to keep the code decoupled and make most of these areas of concern separate.

  • The Drivetrain should give Commands access to certain information about itself, the ability to make the motors turn, and nothing more.
  • The commands to drive the robot via driver control don't care how the Drivetrain makes the robot drive, just that it can control the motors. It takes the user input and translates it in some fashion to motor commands.
  • The Gyroscope is tightly related to the drivetrain - it's basically just another piece of information taht the drivetrain can report about itself. It should be part of the subsystem
  • The command(s) that use the gyro should use the gyro output from the Drivetrain as the input to the PID loop and commands to the Drivetrain as the output.

My recommendations:

  • The gyro should be inside the Drivetrain subsystem, but as a Gyro object, not a custom PID subsystem.
    • We should never have a need for a Subsystem inside another Subsystem. the only purpose for a class to be a Subsystem is so that Commands can "require" it. Things internal to a subsystem that are not exposed to commands should never be Subsystems.
    • PIDSubsystem is for when the subsystem in question is (almost) always going to be under PID control. This is not true for our gyro functions. This would be true for something like the tote elevator.
  • The turning commands themselves are what should use a PIDController (This may be an appropriate use for the PIDCommand class). The input will be the readings from the gyro, and the output will give you numberson which to abse your motor commands.

@pordonj
Copy link
Contributor Author

pordonj commented Jan 28, 2015

@ABaade and @SMLange are working on this, and have a command that turns 90, once it can go to a arbtrary angle we will merge it in

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

No branches or pull requests

1 participant