Struct RobotBase

Source
pub struct RobotBase {}

Implementations§

Source§

impl RobotBase

Though many methods are static for convenience, they will error if a a RobotBase has not already been constructed.

Source

pub fn new() -> Result<RobotBase, RobotBaseInitError>

Create a new robot, initializing hardware in the process. Call before initializing any other wpilib stuff.

Source

pub fn start_competition()

Call when your robot is ready to be enabled. Make sure your hardware and threads have been created, etc.

Source

pub fn make_ds(&self) -> DriverStation<'_>

Source

pub fn fpga_version() -> HalResult<i32>

Return the FPGA Version number.

For now, expect this to be competition year.

Source

pub fn fpga_revision() -> HalResult<i64>

Return the FPGA Revision number.

The format of the revision is 3 numbers. The 12 most significant bits are the Major Revision. The next 8 bits are the Minor Revision. The 12 least significant bits are the Build Number.

Source

pub fn fpga_time() -> HalResult<u64>

Read the microsecond-resolution timer on the FPGA.

Returns The current time in microseconds according to the FPGA (since FPGA reset).

Source

pub fn fpga_time_duration() -> HalResult<Duration>

Read the microsecond-resolution timer on the FPGA as a std::time::Duration.

Source

pub fn user_button() -> HalResult<bool>

Get the state of the “USER” button on the roboRIO.

True if the button is currently pressed.

Source

pub fn is_browned_out() -> HalResult<bool>

Reuturns true if the robot is browned out.

Source

pub fn is_system_active() -> HalResult<bool>

Returns true if outputs are enabled. A false result could be caused by a disabled robot or a brownout.

Source

pub fn battery_voltage() -> HalResult<f64>

Get the robot’s current battery voltage.

Trait Implementations§

Source§

impl Debug for RobotBase

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for RobotBase

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.