Team2168 / 2014_Main_Robot

Code for the 2014 FRC season.
Other
2 stars 1 forks source link

Create command to move the drivetrain a specified distance #17

Closed jcorcoran closed 10 years ago

jcorcoran commented 10 years ago

Develop a command which will drive the robot, in a straight line, a specified distance.

This command will be instrumental in autonomous.

You can check the 2013 robot code for one way of approaching the problem, but there are many ways to solve the problem: https://github.com/Team2168/FRC2013_Main_Robot/blob/master/FRC2013_Main_Robot/src/frc2168_2013/commands/subSystems/DriveTrain/DriveDrivetrainStraight.java

ghost commented 10 years ago

Looking at the code from last year, is the execute method of a command run over and over again until isFinished() returns true? That seems to be the case last year, but so far our MoveForwardXDistance just assumes that execute is only run once.

jcorcoran commented 10 years ago

Yes that is the case.

It is imperative that execute() completes in a timely manner. If it doesn't we will lose communications with the field.

The following resources should give all the info you need On the command based robot project:

There's an article on the team website that gives my brief overview of what the command based robot project is all about: http://team2168.org/index.php/resources/programming/272-the-command-based-robot-project

There are two items linked at the bottom of that article:

Powerpoint presentation introducing the command based robot project (starts on slide 18): http://simplerobotics.org/cRIO/2012NewFeatures.pdf WPILib Cookbook: http://firstforge. wpi.edu/sf/docman/do/listDocuments/projects.wpilib/docman.root.c_and_java_documentation

Complimenting the cookbook are a series of videos on youtube under this account: http://www.youtube.com/user/BradAMiller

1 Introduction: http://www.youtube.com/watch?v=v0vt9yKLxUQ 2 Claw: http://www.youtube.com/watch?v=PpDX0CAcUNc 3 Elevator and Wrist: http://www.youtube.com/watch?v=j2Xz8bRRcF0 4 Command Groups: http://www.youtube.com/watch?v=QRv98SaVS6E 5 Drivetrain http://www.youtube.com/watch?v=BZ9l4DAaUAI 6 Autonomous http://www.youtube.com/watch?v=5rJLi-QOflc

The cookbook alone was what Kevin and I used in 2012 to get up to speed with Command base. The resourses above are all circa 2012, but are all still applicable. Last year WPI created a nice web page with a lot of resources and instructions, this is their section on the command based robot project: http://wpilib.screenstepslive.com/s/3120/m/7952 I haven't really gone through it, so I can't speak to it's merit, but most of the material on this wpilib.screenstepslive is good quality. It's probably another good resource to check out.

Sent from mobile.

jcorcoran commented 10 years ago

Per what we discussed on Thurs. this week. The cleanest implementation is likely something like this:

drive.arcadeDrive(stick.getY(), kP*gyro.get()).

Unfortunately we aren't making use of the RobotDrive class, which the arcadeDrive method is a part of. We could always just pull the source code out of their repo and import it as a new class/method in our code