:py:mod:`phoenix6.hoot_replay` ============================== .. py:module:: phoenix6.hoot_replay Module Contents --------------- Attributes ~~~~~~~~~~ .. autoapisummary:: phoenix6.hoot_replay.T .. py:data:: T .. py:class:: HootReplay Static class for controlling Phoenix 6 hoot log replay. This replays the given hoot log in simulation. Hoot logs can be created by a robot program using SignalLogger. Only one hoot log, corresponding to one CAN bus, may be replayed at a time. This replays all signals in the given hoot log in simulation. Hoot logs can be created by a robot program using SignalLogger. Only one hoot log, corresponding to one CAN bus, may be replayed at a time. During replay, all transmits from the robot program are ignored. This includes features such as control requests, configs, and setting signal update frequency. Additionally, Tuner X is not functional during log replay. To use Hoot Replay, call load_file(str) before any devices are constructed to load a hoot file and start replay. Alternatively, the CANBus(str, str) constructor can be used when constructing devices. After devices are constructed, Hoot Replay can be controlled using play(), pause(), stop(), and restart(). Additionally, Hoot Replay supports step_timing(second) while paused. The current file can be closed using close_file(), after which a new file may be loaded. .. py:class:: SignalData Bases: :py:obj:`Generic`\ [\ :py:obj:`T`\ ] Stores information about a user signal from replay. .. py:attribute:: name :type: str :value: '' The name of the signal .. py:attribute:: units :type: str :value: '' The units of the signal .. py:attribute:: timestamp :type: phoenix6.units.second :value: 0 The timestamp of the signal, in seconds .. py:attribute:: status :type: phoenix6.status_code.StatusCode Status code response of getting the signal .. py:attribute:: value :type: T The value of the signal .. py:method:: load_file(filepath: str) -> phoenix6.status_code.StatusCode :staticmethod: Loads the given file and starts signal log replay. Only one hoot log, corresponding to one CAN bus, may be replayed at a time. This must be called before constructing any devices or checking CAN bus status. The CANBus(canbus, hoot_filepath) constructor can be used when constructing devices to guarantee that this API is called first. When using relative paths, the file path is typically relative to the top-level folder of the robot project. This API is blocking on the file read. :param filepath: Path and name of the hoot file to load :type filepath: str :returns: Status of opening and reading the file for replay :rtype: StatusCode :raises ValueError: The file is invalid, unlicensed, or targets a different version of Phoenix 6 .. py:method:: close_file() :staticmethod: Ends the hoot log replay. This stops the replay if it is running, closes the hoot log, and clears all signals read from the file. .. py:method:: is_file_loaded() -> bool :staticmethod: Gets whether a valid hoot log file is currently loaded. :returns: True if a valid hoot log file is loaded :rtype: bool .. py:method:: play() -> phoenix6.status_code.StatusCode :staticmethod: Starts or resumes the hoot log replay. :returns: Status of starting or resuming replay :rtype: StatusCode .. py:method:: pause() -> phoenix6.status_code.StatusCode :staticmethod: Pauses the hoot log replay. This maintains the current position in the log replay so it can be resumed later. :returns: Status of pausing replay :rtype: StatusCode .. py:method:: stop() -> phoenix6.status_code.StatusCode :staticmethod: Stops the hoot log replay. This resets the current position in the log replay to the start. :returns: Status of stopping replay :rtype: StatusCode .. py:method:: restart() -> phoenix6.status_code.StatusCode :classmethod: Restarts the hoot log replay from the start of the log. This is equivalent to calling stop() followed by play(). :returns: Status of restarting replay :rtype: StatusCode .. py:method:: is_playing() -> bool :classmethod: Gets whether hoot log replay is actively playing. This API will return true in programs that do not support replay, making it safe to call without first checking if the program supports replay. :returns: True if replay is playing back signals :rtype: bool .. py:method:: wait_for_playing(timeout: phoenix6.units.second) -> bool :staticmethod: Waits until hoot log replay is actively playing. This API will immediately return true in programs that do not support replay, making it safe to call without first checking if the program supports replay. Since this can block the calling thread, this should not be called with a non-zero timeout on the main thread. This can also be used with a timeout of 0 to perform a non-blocking check, which is equivalent to is_playing(). :param timeout: Max time to wait for replay to start playing :type timeout: second :returns: True if replay is playing back signals :rtype: bool .. py:method:: set_speed(speed: float) :staticmethod: Sets the speed of the hoot log replay. A speed of 1.0 corresponds to replaying the file in real time, and larger values increase the speed. - Minimum Value: 0.01 - Maximum Value: 100.0 - Default Value: 1.0 :param speed: Speed of the hoot log replay :type speed: float .. py:method:: step_timing(step_time_seconds: phoenix6.units.second) -> phoenix6.status_code.StatusCode :staticmethod: Advances the hoot log replay time by the given value. Replay must be paused or stopped before advancing its time. :param step_time_seconds: The amount of time to advance :type step_time_seconds: second :returns: Status of advancing the replay time :rtype: StatusCode .. py:method:: get_raw(name: str) -> SignalData[bytearray] :classmethod: Gets a raw-bytes user signal. :param name: Name of the signal :type name: str :returns: Structure with all information about the signal :rtype: SignalData[bytearray] .. py:method:: get_boolean(name: str) -> SignalData[bool] :classmethod: Gets a boolean user signal. :param name: Name of the signal :type name: str :returns: Structure with all information about the signal :rtype: SignalData[bool] .. py:method:: get_integer(name: str) -> SignalData[int] :classmethod: Gets an integer user signal. :param name: Name of the signal :type name: str :returns: Structure with all information about the signal :rtype: SignalData[int] .. py:method:: get_float(name: str) -> SignalData[float] :classmethod: Gets a float user signal. :param name: Name of the signal :type name: str :returns: Structure with all information about the signal :rtype: SignalData[float] .. py:method:: get_double(name: str) -> SignalData[float] :classmethod: Gets a double user signal. :param name: Name of the signal :type name: str :returns: Structure with all information about the signal :rtype: SignalData[float] .. py:method:: get_string(name: str) -> SignalData[str] :classmethod: Gets a string user signal. :param name: Name of the signal :type name: str :returns: Structure with all information about the signal :rtype: SignalData[str] .. py:method:: get_boolean_array(name: str) -> SignalData[list[bool]] :classmethod: Gets a boolean array user signal. :param name: Name of the signal :type name: str :returns: Structure with all information about the signal :rtype: SignalData[list[bool]] .. py:method:: get_integer_array(name: str) -> SignalData[list[int]] :classmethod: Gets an integer array user signal. :param name: Name of the signal :type name: str :returns: Structure with all information about the signal :rtype: SignalData[list[int]] .. py:method:: get_float_array(name: str) -> SignalData[list[float]] :classmethod: Gets a float array user signal. :param name: Name of the signal :type name: str :returns: Structure with all information about the signal :rtype: SignalData[list[float]] .. py:method:: get_double_array(name: str) -> SignalData[list[float]] :classmethod: Gets a double array user signal. :param name: Name of the signal :type name: str :returns: Structure with all information about the signal :rtype: SignalData[list[float]]