RobotMap Class

Purpose

Every Robot has lots of Talons, sensors, and other attachments, and each live somewhere in the body of the robot; in the code, these objects live in RobotMap. Each device connected to the robot should be declared as a public static class variable of RobotMap, and must be instantiated and settings configured within the init() method. These objects will then be used to greater subsystem and sensor classes to control the robot.

WPI_TalonSRX

Talons are speed controllers each connected to a Robot's motor so that we can program its movement. We rarely have used Victors, but if we do, the code for those is relatively the same. As of 2019, in order to program these Talons in Visual Studio Code, you need to run the WPILib: Manage Vendor Libraries command, and install a new library online with this link. More info for the talon software and the talon tuner can be found here. The tuner program is especially important because it is used to give each talon a specific numerical ID, which will then be used in our code to instantiate the talon. Start each talon ID from 20 upwards, and whenever you change the name or ID of a talon in the tuner, perform a test blink to verify you changed what you were expecting. Apart from instantiation, the configuration of each talon object involves reversing necessary motors, setting slaves and masters, setting encoders, and reversing encoders. Each of these methods can be found in the CTRE Documentation.

Pneumatics

The Pneumatics configuration is very simple and should be done in RobotMap. To make the compressor active and stop when necessary, simply instantiating it will allow it do that (Defualt ID is 50). Each solenoid should also be instantiated and put in the state that the robot should be in when it starts up.

Sensors

Sensors including but not limited to, gyros, ultasonics, limit switches and potentiometers should also be instantiated in init(). The NAVX library (Gyro sensor) needs to also be added the same way as the Talons, but with this link instead.


© All Rights Reserved.