phoenix6.utils

Module Contents

Functions

get_current_time_seconds(→ phoenix6.units.second)

Get the current timestamp in seconds.

get_system_time_seconds(→ phoenix6.units.second)

Get the system timestamp in seconds.

is_simulation(→ bool)

Get whether the program is running in simulation.

is_replay(→ bool)

Get whether the program is running in replay mode.

fpga_to_current_time(→ phoenix6.units.second)

Converts an FPGA timestamp to the timebase

Attributes

phoenix6.utils.USE_WPILIB = True
phoenix6.utils.get_current_time_seconds() phoenix6.units.second

Get the current timestamp in seconds.

This is the time source used for status signals.

This time source is typically continuous and monotonic. However, it may be overridden in simulation to use a non-monotonic, non-continuous source.

Returns:

Current time in seconds

Return type:

second

phoenix6.utils.get_system_time_seconds() phoenix6.units.second

Get the system timestamp in seconds.

This is NOT the time source used for status signals. Use GetCurrentTImeSeconds instead when working with status signal timing.

This time source is guaranteed to be continuous and monotonic, making it useful for measuring time deltas in a robot program.

Returns:

System time in seconds

Return type:

second

phoenix6.utils.is_simulation() bool

Get whether the program is running in simulation.

Returns:

True if in simulation

Return type:

bool

phoenix6.utils.is_replay() bool

Get whether the program is running in replay mode.

Returns:

True if in replay mode

Return type:

bool

phoenix6.utils.fpga_to_current_time(fpga_time: phoenix6.units.second) phoenix6.units.second

Converts an FPGA timestamp to the timebase reported by get_current_time_seconds().

Parameters:

fpga_time (second) – The FPGA timestamp

Returns:

The equivalent get_current_time_seconds() timestamp

Return type:

second