frc868 / 2017-robot Goto Github PK
View Code? Open in Web Editor NEWThe code for FRC 868's 2017 robot, Ratchet
The code for FRC 868's 2017 robot, Ratchet
Add to .classpath
(eventually) - maybe then add to .gitignore
since it's a pretty user-specific path for the docs.
0 degrees will need to be determined (probably the halfway point between limits) and then we need to figure out how far each way we can rotate, then limit the various subsystem set...() methods so they can't force the turret to rotate further.
DigitalInput
for now)Any field within a Subsystem that is modified or read by a separate Thread should be declared volatile
to ensure synchronicity.
It's currently unfinished
Change shooter/otherShooter to left/right shooter...see RobotMap for which is which.
Implementable interface which forces you to provide a record()
method or something, which then returns a value that can be saved to a CSV file or something.
The feeder should only be able to be run forward if the shooter's speed is higher than some minimum amount - this will prevent the ball from getting lodged in the shooter wheel. The feeder should still be able to be run backwards.
Using PID, though manual setting could be done (in Command?).
Drive will be a bit different, since we can't simply read the value from the CANTalon
(they're going to have Sparks
).
Some auton routines will be run after others, for example dropping off a gear first then driving over to dump the hoppers.
Drives forward, attempts to correct for deviation with the gyro.
Idea for simpler command structure:
CommandFactory
CommandFactory
has static methods such as getGearOpenCommand()
or getGearClosedCommand()
CommandFactory
calls subsystem-related command factories, such as GearCommandFactory
GearCommandFactory
take arguments such as a boolean for open/closed, build a command via creating a new object and calling the add... methods, and return the created objectPossibly also an AutonFactory itself which adds multiple auton routines from different starting points: for example, builds a DropOffGearCG from RedOne, then a DumpHopperCG from GearPegOne, then a FeedAndShootCG from Hopper.
Instead of Robot Map...
Pre-emtively spins shooter up to speed. We'll need to bind an operator's button to this.
I understand we've been playing with the PixyCam on both Serial and I2C ports...we should have different classes for each of these e.g. ColorPixySubsystemSerial
and ColorPixySubsystemI2C
.
In the constructor, you should call count.setDistancePerPulse(1)
This can only really be done experimentally
?
When a subsystem for a device which uses some sort of serial communication (such as the LIDAR
or PixyCam
over USB or MXP) is constructed and a device isn't attached to that serial port, it throws an exception which breaks the entirety of the robot code.
It would be possible to catch this exception within the constructor itself. This would mean getInstance()
has to do one of two things: return null
which would create NullPointerExceptions
in other parts of the code; or, continue trying to construct the device on the serial port until it succeeds, which would cause the code to hang indefinitely. Neither of these are very good solutions, though they're pretty easy to implement.
The current solution is to simply not use these Subsystems (e.g. don't call them in the UpdateSmartDashboard command) when the devices aren't hooked up OR just hook up every device properly, though both slow down the testing/debugging process.
Instead, we could have the constructor catch this exception and set the serial object to null
. Every method which reads from serial would check to make sure it isn't null before reading, and in the case that it is null would return 0 for any measurement. Additionally, it would be good to have a public connect()
method which reattempts to construct this serial object, and a method isConnected()
which returns serial != null
(essentially if the serial data being read is valid or just returning 0 as the error case).
Alternatively, we could just surround every interaction with the serial
object with a try-catch, and set any expected return values to 0 in the catch statement.
Call to isConnected()
is redundant, as bytesAvailable()
calls isConnected()
as well.
As the IR Pixy Subsystem is now threaded, any of the getters or setters to the class fields need to be declared synchronized
. These include methods such as processRecord()
and getSizeOfTarget()
.
Just use the IRPixySubsystem
as a template.
Currently sets the power of the motor, but sets it to about 0.8 volts. Should instead use the PID to set an RPS of something like 80.
I think it might be better to name it TurnToAngle
in order to better differentiate it from RotateTurretToAngle
...what do you think?
RotateUsingIRPixy will probably be started anyways at the beginning of auton or teleop, though it'd be good just to double check that it's running.
Sort out the difference between the DriveSubsystem
and the DriveTrainSubsystem
.
I'm noticing inconsistencies in the code (spaces vs. tabs, space between () and {, if x rather than if { x }, etc), and thinking that a unified style guide may be in order.
As an initial proposition, the Google Java Style Guide may work.
Pretty simple, move the submodule
into src/
, change necessary imports (only for the gyro really), and remove the copy/pasted lib/gyro
source files.
Doing it sooner than later would be good, as it would likely mean less refactoring.
Positions:
Auton Routines
Using Atif's code from last year and Team 254's library.
More files tbd.
As in the title. Also (probably) a prerequisite for any kind of turret stops.
It is possible with Java 8, though I'm not sure if the syntax for implementing static methods in interfaces is any different.
For the last one, the setupDriver and setupOperator should still be encapsulated to look nice.
Mostly import stuff, may be some other issues too
Should repeatedly move agitator back & forth. We should bind an operator button to this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.