wpilib functions

wpilib.getCurrentThreadPriority() → Tuple[int, bool]

Get the thread priority for the current thread

Parameters

isRealTime – Set to true if thread is realtime, otherwise false.

Returns

The current thread priority. Scaled 1-99.

wpilib.getTime() → seconds

Gives real-time clock system time with nanosecond resolution

Returns

The time, just in case you want the robot to start autonomous at 8pm on Saturday.

wpilib.run(robot_class, **kwargs)[source]

This function gets called in robot.py like so:

if __name__ == '__main__':
    wpilib.run(MyRobot)

This function loads available entry points, parses arguments, and sets things up specific to RobotPy so that the robot can run. This function is used whether the code is running on the roboRIO or a simulation.

Parameters
  • robot_class – A class that inherits from RobotBase

  • kwargs – Keyword arguments that will be passed to the executed entry points

Returns

This function should never return

wpilib.setCurrentThreadPriority(realTime: bool, priority: int) → bool

Sets the thread priority for the current thread

Parameters
  • realTime – Set to true to set a realtime priority, false for standard priority.

  • priority – Priority to set the thread to. Scaled 1-99, with 1 being highest. On RoboRIO, priority is ignored for non realtime setting.

Returns

The success state of setting the priority

wpilib.wait(seconds: seconds) → None

Pause the task for a specified time.

Pause the execution of the program for a specified period of time given in seconds. Motors will continue to run at their last assigned values, and sensors will continue to update. Only the task containing the wait will pause until the wait time is expired.

Parameters

seconds – Length of time to pause, in seconds.