For the complete documentation index, see llms.txt. This page is also available as Markdown.

Programming - Initialization

Before our program begins, we need to do some set up first as part of initialization. This section of code will run when "Init" is pressed on the Driver Hub and before "Play" is pressed!

Initialization code for the FGC Starter Bot

Motor Settings

The motors on the drivetrain are mirrored with each other. If we set them to run the same direction then the robot will only spin in a circle! Instead, we will set the left motor to run in reverse allowing us to drive normally.

As for the motors used for the flywheel, because we plan to use velocity we need the encoders enabled to receive proper measurements.

Motor Settings for the FGC Starter Bot

Variables

We will be using velocity for the flywheel motors. We can create a variable for our target velocity to make it easy to make adjustments later if we increase or decrease the target.

targetVelocity Variable

Velocity is measured in ticks per second.

Last updated

Was this helpful?