discover_utils module¶
- class discover_utils.Config¶
Bases:
object
This config class exists only as an abstract class through which common functionality between different RoverAPI classes is implemented.
Methods
get_info
()Returns information about the given sensor.
Determines whether or not the given sensor is available.
- get_info()¶
Returns information about the given sensor. Information is returned in whatever format the sensor has chosen.
- Parameters:
- None
- Returns:
- sensor_info
The sensor information in an unspecified format.
- is_available()¶
Determines whether or not the given sensor is available.
- Parameters:
- None
- Returns:
- bool
A boolean stating whether or not the sensor is available.
- discover_utils.finish_experiment()¶
This function should be called whenever a user experiment is finished. This will call the user’s finished callback function, doing whatever cleanup they may need. Additionally, this will be called when the rover goes into low power mode.
- Parameters:
- None
- Returns:
- None
Examples
>>> from rover_api.discover_utils import get_time_str, finish_experiment >>> from rover_api.discover_camera import Camera >>> from rover_api.discover_init import ExperimentInitializer >>> def finished_cb(): >>> print(f"Finished at: {get_time_str()}") >>> >>> initializer = ExperimentInitializer(finished_cb) >>> cam = Camera() >>> finish_experiment()
- discover_utils.get_time_str(in_time: Time | None = None, extension: str = '') str ¶
This function returns the current time this specific format: /experiment/day-month-year_hours:minutes:seconds. The prefix /experiment is included so files can be easily stored according to the time they were created.
- Parameters:
- in_timeTime
The current time according the ROS core. The default value is None.
- extensionstr
A string value that should pertain to a file extension. For rosbags it should be .bag, for images it should be .jpg, etc.
- Returns:
- str
A string with the formatted time.
Examples
>>> from rover_api.discover_utils import get_time_str >>> from rover_api.discover_camera import Camera >>> def cb_func(): >>> print(f"New image at: {get_time_str()}") >>> >>> cam = Camera(callback=cb_func)