什么是WPILib?

The WPI Robotics Library (WPILib) is the standard software library provided for teams to write code for their FRC® robots. WPILib contains a set of useful classes and subroutines for interfacing with various parts of the FRC control system (such as sensors, motor controllers, and the driver station), as well as an assortment of other utility functions.

支持的语言

There are two versions of WPILib, one for each of the two officially-supported text-based languages: WPILibJ for Java, and WPILibC for C++. A considerable effort is made to maintain feature-parity between these two languages - library features are not added unless they can be reasonably supported for both Java and C++, and when possible the class and method names are kept identical or highly-similar. While unofficial community-built support is available for some other languages, notably python, this documentation will only cover Java and C++. Java and C++ were chosen for the officially-supported languages due to their appropriate level-of-abstraction and ubiquity in both industry and high-school computer science classes.

总的来说,C++提供了更好的高端性能,但代价是增加了用户的工作量(内存必须手动处理,而且C++编译器在确保用户代码不会在运行时崩溃方面做的较少)。Java提供的性能较差,但更方便。强烈鼓励新的/没有经验的用户使用Java。

源代码和文档

WPILib是一个开源库——它的全部源代码都可以在WPILib GitHub页面上在线获得:

可以在WPILibJ和WPILibC源目录中找到Java和C++源代码:

虽然强烈建议用户阅读源代码来解决有关库功能的详细问题,但是可以在WPILibJ和WPILibC的官方文档页面上找到更简洁的文档: