Download C/C++ Programming Guide for the FIRST Robotics Competition

Transcript
Contents
Getting Started ........................................................................................................................................ 5
What is the WPI Robotics Library ....................................................................................................... 6
A simple robot program....................................................................................................................... 8
Using objects....................................................................................................................................... 9
Writing C programs ........................................................................................................................... 11
Using Wind River Workbench............................................................................................................... 13
Setting up the environment ................................................................................................................ 14
Creating a robot project ..................................................................................................................... 18
Building your project......................................................................................................................... 20
Downloading the project to the cRIO ................................................................................................. 21
Debugging your robot program.......................................................................................................... 22
Deploying the C/C++ Program .......................................................................................................... 26
Creating a Robot Program ..................................................................................................................... 27
Pointers and addresses ....................................................................................................................... 30
Built-in Robot classes ........................................................................................................................ 31
SimpleRobot class ............................................................................................................................. 32
IterativeRobot class ........................................................................................................................... 33
WPI Robotics Library Conventions.................................................................................................... 34
RobotBase class................................................................................................................................. 36
Watchdog timer class......................................................................................................................... 37
Sensors.................................................................................................................................................. 38
Digital I/O Subsystem........................................................................................................................ 39
Digital Inputs..................................................................................................................................... 40
Digital Outputs .................................................................................................................................. 41
Accelerometer ................................................................................................................................... 42
Gyro.................................................................................................................................................. 43
HiTechnicCompass............................................................................................................................ 45
Ultrasonic rangefinder ....................................................................................................................... 46