Recent Updates
-
Updated on: Jan 20, 2023
Measuring rotation of a wheel or other shaft using encoders
Encoders are devices for measuring the rotation of a spinning shaft. Encoders are typically used to measure the distance a wheel has turned which can be translated into the distance the robot has traveled. The distance traveled over a measured period of time represents the speed of the robot, and is another common use for encoders. Encoders can also directly measure the rate of rotation by determining the time between pulses. This article covers the use of quadrature encoders (defined below) For non-quadrature incremental encoders, see the article on counters. For absolute encoders the appropriate article will depend on the input type (most commonly analog, I2C or SPI).
Manual WPILib programming -
Updated on: Jan 20, 2023
Accelerometers - measuring acceleration and tilt
Accelerometers measure acceleration in one or more axis. One typical usage is to measure robot acceleration. Another common usage is to measure robot tilt, in this case it measures the acceleration due to gravity.
Manual WPILib programming -
Updated on: Jan 20, 2023
What is WPILib
The WPI Robotics library (WPILib) is a set of software classes that interfaces with the hardware and software in your FRC robot’s control system. There are classes to handle sensors, motor speed controllers, the driver station, and a number of other utility functions such as timing and field management. In addition, WPILib supports many commonly used sensors that are not in the kit, such as ultrasonic rangefinders.
Manual WPILib programming -
Updated on: Jan 20, 2023
Using Counters
Counter objects are extremely flexible elements that can count input from either a digital input signal or an analog trigger.
Manual WPILib programming -
Updated on: Jan 20, 2023
Driving the robot with tank drive and joysticks
A common use case is to have a joystick that should drive some actuators that are part of a subsystem. The problem is that the joystick is created in the OI class and the motors to be controlled are in the subsystem. The idea is to create a command that, when scheduled, reads input from the joystick and calls a method that is created on the subsystem that drives the motors.
In this example a drive base subsystem is shown that is operated in tank drive using a pair of joysticks.
Manual RobotBuilder -
Updated on: Jan 20, 2023
Setpoint command
A common use case in robot programs is to drive an actuator to a particular angle or position that is measured using a potentiometer or encoder. This happens so often that there is a shortcut in RobotBuilder to do this task. It is called the Setpoint command and it's one of the choices on the palette or the right-click context menu that can be inserted under "Commands".
Manual RobotBuilder -
Updated on: Jan 20, 2023
Building with the WPILib source code
Often it is desirable to build your robot project with the WPILib source code rather than just using the supplied libraries. This might be because you are modifying the library or just trying to understand how it works. WindRiver Workbench has provisions for having one project (your robot program) reference another project (WPILib in this case). So the strategy to build with WPILib is to open it as a project in Workbench.
Manual Getting started with C++ -
Updated on: Jan 20, 2023
Using TableViewer to see NetworkTable values
TableViewer is a program to help debug NetworkTables applications. It acts as a NetworkTables client and allows the viewing of all the keys and associated values in a tabular format. You can use this to quickly see the value of a variable or set a value for a variable. This is a java program making it platform independent - it can run anywhere that the java runtime is installed.
Manual WPILib programming -
Updated on: Jan 20, 2023
Displaying LiveWindow values
Typically LiveWindows are displayed as part of the automatically generated RobotBuilder code. You may also display LiveWindow values by writing the code yourself and adding it to your robot program. LiveWindow will display values grouped in subsystems. This is a convenient method of displaying whether they are actual command based program subsystems or just a grouping that you decide to use in your program.
Manual SmartDashboard -
Updated on: Jan 20, 2023
RobotBuilder generated code
Manual RobotBuilder