cameras_get_image_frame¶
Overview¶
This example retrieves an image frame from a specified camera on the robot. The user can select the camera either via a command-line argument or through an interactive terminal menu.
Execution¶
There are two ways to execute this example:
Specify the camera directly using an argument:
python3 cameras_get_image_frame/ --auto-run -c <camera_name>
python3 cameras_get_image_frame/ --auto-run --camera <camera_name>
Example:
python3 cameras_get_image_frame/ --auto-run --camera nav_top
Select the camera via an interactive terminal menu:
If no camera argument is provided, the user will be prompted to select a camera from a menu:
python3 cameras_get_image_frame/ --auto-run
If the terminal window is too small, a notification will appear instructing the user to resize it.
The user selects a camera by pressing the Enter key.
Behavior¶
If a camera is provided as an argument, it is used directly.
If no camera argument is provided, the user selects a camera from the menu.
- Once a camera is selected:
The application checks and prints the camera’s status.
If the camera is running, a snapshot is taken.
The snapshot is then published to the robot’s chest display.
Inputs¶
Optional command-line argument for selecting a camera (-c or –camera).
User input via terminal menu when no camera argument is provided.
Outputs¶
Log messages indicating the camera’s status and actions taken.
A snapshot is captured and published to the robot’s chest display.
Example Output¶
During execution, the output logs follow this pattern:
[INFO] [timestamp] [pyraya.cameras_get_image_frame]: Auto running the app
[INFO] [timestamp] [pyraya.cameras_get_image_frame]: The <camera_name> camera status is running ✅
[WARNING] [timestamp] [pyraya.cameras_get_image_frame]: Taking snapshot 📸 ...
[WARNING] [timestamp] [pyraya.cameras_get_image_frame]: Publishing frame on the chest... 🖥️
Additionally, an example output image is displayed below:
Key Notes¶
If the terminal window is too small, the user must resize it to see the menu options.
If a camera is not running, no snapshot is taken.
If the camera or the chest display is not available, the application logs an error message and exits gracefully.