#include <ui_piano.h>
|
| | PianoUI () |
| | Hybrid Qt-ROS2 Class for managing the User Interface of the MIDI-to-UR3 system.
|
| |
| | ~PianoUI () |
| | Standard Destructor for PianoUI Class.
|
| |
|
| void | play_pause () |
| | Toggles the playback state and notifies the /MIPI/play_pause service.
|
| |
| void | open_midi_file () |
| | UI Slot for opening a file dialog to process a raw .mid file.
|
| |
| void | toggle_direction () |
| | Toggles between Forward and Reverse playback logic.
|
| |
| void | set_direction_forward () |
| | Explicitly sets playback direction to Forward via the /MIPI/direction service.
|
| |
| void | set_direction_reverse () |
| | Explicitly sets playback direction to Reverse via the /MIPI/direction service.
|
| |
| void | send_time_scale () |
| | Transmits the current speed slider value as a time scale factor (0.01-1.0) to the robot.
|
| |
| void | send_channel_selection (int index) |
| | Transmits the selected MIDI channel to the robot controller.
|
| |
| void | load_existing_mipi (int index) |
| | UI Slot for loading a file selected from the dropdown menu.
|
| |
| void | send_debug_request () |
| | Sends a trigger request to the debug service for development testing.
|
| |
|
| void | update_status_info () |
| | Refreshes all status labels in the UI with the latest system state information.
|
| |
| void | force_pause_and_reset () |
| | Immediate helper method to halt UI playback tracking and reset visual sliders.
|
| |
| void | populate_mipi_combobox () |
| | Scans the ~/mipi_files directory to refresh the dropdown list.
|
| |
| void | update_channel_radio_buttons () |
| | Rebuilds the radio button group based on the currently loaded MIDI processor data.
|
| |
| void | image_callback (const sensor_msgs::msg::Image::SharedPtr msg) |
| | ROS 2 Subscriber callback for camera feed.
|
| |
◆ PianoUI()
Hybrid Qt-ROS2 Class for managing the User Interface of the MIDI-to-UR3 system.
- This class inherits from QWidget and rclcpp::Node. It contains the following ROS2 I/O:
- Service Clients
/MIPI/play_pause (jamc/srv/Func): Triggers a play/pause state change on the robot.
/MIPI/direction (jamc/srv/Func): Toggles the playback direction (Forward/Reverse).
/MIPI/time_scale (jamc/srv/TimeScale): Sends a float (0.01 to 1.0) to scale robot velocity.
/MIPI/load (jamc/srv/Load): Sends the filepath and instrument index to the controller.
- Subscriptions
/camera/camera/color/image_raw (sensor_msgs/msg/Image): Receives live feed for UI visualization.
◆ ~PianoUI()
| UI::PianoUI::~PianoUI |
( |
| ) |
|
Standard Destructor for PianoUI Class.
◆ force_pause_and_reset()
| void UI::PianoUI::force_pause_and_reset |
( |
| ) |
|
|
private |
Immediate helper method to halt UI playback tracking and reset visual sliders.
Sends a PAUSE request to the robot and resets the track slider to zero. Always enforces a Forward direction state.
◆ image_callback()
| void UI::PianoUI::image_callback |
( |
const sensor_msgs::msg::Image::SharedPtr |
msg | ) |
|
|
private |
ROS 2 Subscriber callback for camera feed.
Callback function for processing incoming ROS 2 image messages.
- Parameters
-
| msg | Shared pointer to the image message. |
- Note
- Uses QMetaObject::invokeMethod to ensure thread-safety when updating the UI thread from the ROS executor thread.
- Parameters
-
| msg | A shared pointer to the incoming sensor_msgs::msg::Image. |
- Note
- This uses QMetaObject::invokeMethod to ensure the UI update happens on the main thread, avoiding thread collisions with the ROS executor.
◆ load_existing_mipi
| void UI::PianoUI::load_existing_mipi |
( |
int |
index | ) |
|
|
privateslot |
UI Slot for loading a file selected from the dropdown menu.
- Parameters
-
| index | The index of the selected file in the QComboBox. |
◆ open_midi_file
| void UI::PianoUI::open_midi_file |
( |
| ) |
|
|
privateslot |
UI Slot for opening a file dialog to process a raw .mid file.
Converts the file to .mipi and automatically selects the first available channel for loading.
◆ play_pause
| void UI::PianoUI::play_pause |
( |
| ) |
|
|
privateslot |
Toggles the playback state and notifies the /MIPI/play_pause service.
◆ populate_mipi_combobox()
| void UI::PianoUI::populate_mipi_combobox |
( |
| ) |
|
|
private |
Scans the ~/mipi_files directory to refresh the dropdown list.
- Note
- Blocks signals during execution to prevent recursive load triggers.
◆ send_channel_selection
| void UI::PianoUI::send_channel_selection |
( |
int |
button_id | ) |
|
|
privateslot |
Transmits the selected MIDI channel to the robot controller.
Sends a load request to the robot controller for a specific instrument channel.
- Parameters
-
| button_id | The ID of the clicked radio button (mapped to MIDI channel). |
- Precondition
- A .mipi file must be loaded.
- Postcondition
- Resets playback to ensure the robot starts the new channel from a safe state.
- Parameters
-
| button_id | The ID of the radio button corresponding to the instrument index. |
Clears the current playback state before sending the new file data to the robot.
◆ send_debug_request
| void UI::PianoUI::send_debug_request |
( |
| ) |
|
|
privateslot |
Sends a trigger request to the debug service for development testing.
◆ send_time_scale
| void UI::PianoUI::send_time_scale |
( |
| ) |
|
|
privateslot |
Transmits the current speed slider value as a time scale factor (0.01-1.0) to the robot.
◆ set_direction_forward
| void UI::PianoUI::set_direction_forward |
( |
| ) |
|
|
privateslot |
Explicitly sets playback direction to Forward via the /MIPI/direction service.
◆ set_direction_reverse
| void UI::PianoUI::set_direction_reverse |
( |
| ) |
|
|
privateslot |
Explicitly sets playback direction to Reverse via the /MIPI/direction service.
◆ toggle_direction
| void UI::PianoUI::toggle_direction |
( |
| ) |
|
|
privateslot |
Toggles between Forward and Reverse playback logic.
◆ update_channel_radio_buttons()
| void UI::PianoUI::update_channel_radio_buttons |
( |
| ) |
|
|
private |
Rebuilds the radio button group based on the currently loaded MIDI processor data.
◆ update_status_info()
| void UI::PianoUI::update_status_info |
( |
| ) |
|
|
private |
Refreshes all status labels in the UI with the latest system state information.
◆ _camera_sub
| rclcpp::Subscription<sensor_msgs::msg::Image>::SharedPtr UI::PianoUI::_camera_sub |
|
private |
◆ _camera_view
| QLabel* UI::PianoUI::_camera_view |
|
private |
◆ _channel_group
| QButtonGroup* UI::PianoUI::_channel_group |
|
private |
◆ _channel_layout
| QVBoxLayout* UI::PianoUI::_channel_layout |
|
private |
◆ _channel_select
| QRadioButton* UI::PianoUI::_channel_select |
|
private |
◆ _channel_title
| QLabel* UI::PianoUI::_channel_title |
|
private |
◆ _debug_button
| QPushButton* UI::PianoUI::_debug_button |
|
private |
◆ _direction_button
| QPushButton* UI::PianoUI::_direction_button |
|
private |
◆ _midi_file_path
| QString UI::PianoUI::_midi_file_path |
|
private |
◆ _new_file_button
| QPushButton* UI::PianoUI::_new_file_button |
|
private |
◆ _new_file_label
| QLabel* UI::PianoUI::_new_file_label |
|
private |
◆ _old_file_button
| QComboBox* UI::PianoUI::_old_file_button |
|
private |
◆ _old_file_label
| QLabel* UI::PianoUI::_old_file_label |
|
private |
◆ _play_pause_button
| QPushButton* UI::PianoUI::_play_pause_button |
|
private |
◆ _speed_control
| QSlider* UI::PianoUI::_speed_control |
|
private |
◆ _speed_val
| QLabel* UI::PianoUI::_speed_val |
|
private |
◆ _status_val
| QLabel* UI::PianoUI::_status_val |
|
private |
◆ _time_val
| QLabel* UI::PianoUI::_time_val |
|
private |
◆ _title
| QLabel* UI::PianoUI::_title |
|
private |
◆ _track_slider
| QSlider* UI::PianoUI::_track_slider |
|
private |
◆ channel_client
| rclcpp::Client<jamc::srv::Load>::SharedPtr UI::PianoUI::channel_client |
|
private |
◆ current_dir
◆ debug_client
| rclcpp::Client<jamc::srv::Func>::SharedPtr UI::PianoUI::debug_client |
|
private |
◆ direction_client
| rclcpp::Client<jamc::srv::Func>::SharedPtr UI::PianoUI::direction_client |
|
private |
◆ is_playing
| bool UI::PianoUI::is_playing = false |
|
private |
◆ playback_client
| rclcpp::Client<jamc::srv::Func>::SharedPtr UI::PianoUI::playback_client |
|
private |
◆ processor
◆ time_scale_client
| rclcpp::Client<jamc::srv::TimeScale>::SharedPtr UI::PianoUI::time_scale_client |
|
private |
The documentation for this class was generated from the following files: