Skip to content

awildhooman/NewbieBot

 
 

Repository files navigation

NewbieBot

In this lab, you'll be learning about common robot hardware, subsystems, and how to write robot code!

Robot Hardware

Motors

Motors are one of the most common components on the robot. They turn voltage into a rotation on an output shaft.

NEO

NEO Motor We use NEOs everywhere on our robot, so its good to be familiar with how to use them in code.

Motor Controllers

Motor controllers are how robot code interfaces with motors. They're the middleman between you and the motor, translating your instructions into voltages for the motors.

CANSparkMax

CANSparkMax CANSparkMax is the class/type in java used to control NEO motors.

Solenoids

Solenoids are electronic components that control the air pressure in a piston, causing it to extend or retract.

There are two types of solenoids: normal solenoids and double solenoids. Double solenoids can force the piston to be extended and retracted. Normal solenoids can force the piston to extend, but when the retract they don't force the piston to stay retracted.

piston

Subsystems

Subsystems represent and control mechanisms on the robot like the drivetrain, intake, and shooter. Subsystems are some of the most important parts of our robot code.

In code, a subsystem is a class that has fields for hardware that is physically on the mechanism, including motors, solenoids (pistons), and encoders. The subsystem's methods represent the behaviors that we want the real mechanism to have.

In this lab you'll be coding your own subsystems!

Day 1: Intake

First, we're going to be coding an intake, which brings balls into the robot. The intake is has an arm that hangs in front of the robot with spinning wheels to force balls inwards, and this arm can retract to perpendicular.

The intake has one NEO to drive the wheels on the arm and a double solenoid (two-way) that controls it extending or retracting.

Here is your intake file.

Methods Intake.java should have

Method Description Returns
extend() Extends the intake's solenoid, bringing the intake down. void
retract() Retracts the intake's solenoid, bringing the intake up. void
stop() Stops the intake's drive motor (stop intaking balls). void
acquire() Run the drive motor forwards, bringing balls into the robot with the rollers. void
deacquire() Run the drive motor backwards, pushing balls out of the robot with the rollers. void

Hardware Classes

CANSparkMax

Method Description Returns
CANSparkMax(int port, type) Constructor, takes in a port and a type. Type is normally MotorType.kBrushless. void
get() Returns the set speed of the motor from -1.0 to 1.0. double
set(double speed) Sets the speed of the motor from -1.0 to 1.0. void
setInverted(boolean inverted) Inverts the direction of the motor spinning, takes in a true/false inverted value. void
stopMotor() Stops the motor. void

DoubleSolenoid

Method Description Returns
DoubleSolenoid(type, int extendPort, int retractPort) Constructor, takes in a type which is normally PneumaticsModuleType.CTREPCM and two ports. void
get() Returns which state the solenoid is in (extended or retracted). Value
toggle() Toggles the solenoid between extended and retracted. void

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%