![]() |
Bioscara
DALSA's DIY SCARA Robot Arm.
|
RViz Panel to control the hardware specific functions of the Bioscara robot. More...
#include <bioscara_panel.hpp>
Public Member Functions | |
| BioscaraPanel (QWidget *parent=0) | |
| Construct a new Bioscara Panel object. | |
| ~BioscaraPanel () override | |
| Destroy the Bioscara Panel object. | |
| void | onInitialize () override |
| Automatically invoked by the RViz parent class. Initializes the panel. | |
Protected Member Functions | |
| void | cm_state_callback (const ControllerManagerActivity &msg) |
| callback on reported controller or hardware state changes. | |
| void | joint_state_callback (const DynamicJointState &msg) |
| callback on joint state update. | |
| void | ensure_jsb_is_active (void) |
| Ensure the joint state broadcaster is active. | |
| void | set_hardware_component_state (const std::string component, const lifecycle_msgs::msg::State target_state) |
| Makes a service request to change a hardware component state. | |
| void | configure_controller (const std::string controller) |
| Makes a service request to configure a controller state. | |
| void | switch_controllers (const std::vector< std::string > &activate_controllers, const std::vector< std::string > &deactivate_controllers, const int32_t=SwitchController::Request::BEST_EFFORT, const bool activate_asap=false, const builtin_interfaces::msg::Duration timeout=builtin_interfaces::msg::Duration()) |
| Makes a service request to change controller states. | |
| void | set_controller_state (const std::string controller, const lifecycle_msgs::msg::State target_state) |
| calls the correct functions to bring a controller to the correct state. | |
| void | dynamic_joint_state_msg_to_map (const DynamicJointState &dynamic_joint_state_in, std::unordered_map< std::string, InterfaceValue > &map_out) |
| simple conversion message type conversion function | |
| void | named_lcs_msg_to_map (const std::vector< NamedLifecycleState > &named_lcs_in, std::unordered_map< std::string, NamedLifecycleState > &map_out) |
| simple conversion message type conversion function | |
| void | print_cm_map (const std::string prefix, const std::unordered_map< std::string, NamedLifecycleState > &map_in) |
| Print life-cycle state message to console. | |
| void | prepopulate_joint_state_map (std::unordered_map< std::string, InterfaceValue > &state_map, std::vector< std::string > augment_vec) |
| Prepopulates a state map with a default NamedLifecycleState for every specified key. | |
| void | prepopulate_state_map (std::unordered_map< std::string, NamedLifecycleState > &state_map, std::vector< std::string > augment_vec) |
| Prepopulates a state map with a default NamedLifecycleState for every specified key. | |
| void | update_homing_grp_state (void) |
| Enabl/Disables the homing group depending on the homing controller state. | |
| void | update_homing_state_labels (void) |
| updates all homing state labels. | |
| void | set_homing_state_label (QLabel *label, const InterfaceValue &state) |
| Set state label text and color of the homing state label. | |
| void | update_state_labels_and_btns (void) |
| Update all hardware and controller state lables. | |
| void | update_state_label_and_btn (const std::unordered_map< std::string, NamedLifecycleState > &state_map, QLabel *state_label, QPushButton *en_button, const std::string &state_key) |
| updates component state label and control button. | |
| void | set_state_label (QLabel *label, const NamedLifecycleState &state) |
| Set the state label. | |
| void | set_en_btn (QPushButton *button, const NamedLifecycleState &state) |
| Set the control button state. | |
| bool | check_activation_conditions (const std::string component_key) |
| Check under which conditions a component is allowed to be activated. | |
| lifecycle_msgs::msg::State | target_state_from_current (lifecycle_msgs::msg::State current_state) |
| returns the next logical state from the current one. | |
| void | homing_cmd (const std::string joint, const int cmd) |
| callback function called when a homing button is pressed | |
| void | ctrl_en_btn_cb (const std::string controller) |
| callback on controller enable button | |
Protected Attributes | |
| rclcpp::Node::SharedPtr | node_ |
| Pointer to the parent node. Used for access to the executor. | |
| rclcpp::Subscription< ControllerManagerActivity >::SharedPtr | cm_state_subsription_ |
| Subscription to the the controller_manager state publisher. | |
| rclcpp::Subscription< DynamicJointState >::SharedPtr | joint_state_subsription_ |
| Subscription to the the joint state publisher state publisher. | |
| rclcpp::Publisher< DynamicInterfaceGroupValues >::SharedPtr | homing_publisher_ |
| Publisher to send commands to the homing_controller. | |
| rclcpp::Client< SwitchController >::SharedPtr | switch_controller_client_ |
| Service client to the "/controller_manager/switch_controller" service. | |
| rclcpp::Client< ConfigureController >::SharedPtr | configure_controller_client_ |
| Service client to the "/controller_manager/configure_controller" service. | |
| rclcpp::Client< SetHardwareComponentState >::SharedPtr | hardware_state_client_ |
| Service client to the "/controller_manager/set_hardware_component_state" service. | |
| rclcpp::TimerBase::SharedPtr | prune_timer_ |
| Timer triggered every 5 s to prune unanswered service requests. | |
| std::unordered_map< std::string, InterfaceValue > | joint_states_ |
| Map storing all joint state interface values by each joint. | |
| std::unordered_map< std::string, NamedLifecycleState > | hardware_states_ |
| Map correlating hardware component name to its lifecycle_msgs/State. | |
| std::unordered_map< std::string, NamedLifecycleState > | controller_states_ |
| Map correlating controller name to its lifecycle_msgs/State. | |
| Ui::BioscaraUI * | ui_ |
| The QT object containing all UI elements. | |
Private Slots | |
| void | arm_en_btn_cb (void) |
Tries to set the bioscara_arm hardware component to the active state and tries to enable the velocity_joint_trajectory_controller. | |
| void | gripper_en_btn_cb (void) |
Tries to set the bioscara_gripper_128 hardware component to the active state and tries to enable the gripper_controller. | |
RViz Panel to control the hardware specific functions of the Bioscara robot.
Through the panel it is possible to modify the robot's hardware's and controller states and to execute the homing procedures.
|
explicit |
Construct a new Bioscara Panel object.
Creates a new ui_ object from the ui object autogenerated from the "bioscara_rviz_plugin_frame.ui". This object contains all UI elements. Each button gets assigned a callback function.
| parent |
|
override |
Destroy the Bioscara Panel object.
|
privateslot |
Tries to set the bioscara_arm hardware component to the active state and tries to enable the velocity_joint_trajectory_controller.
|
protected |
Check under which conditions a component is allowed to be activated.
Some controllers will only activate under certain conditions. This functions disables the activation button if the coditions are met.
| component_key |
|
protected |
callback on reported controller or hardware state changes.
Updates the controller_states_ and hardware_states_ state maps. Reactivates the Joint State Broadcaster if it has become inactive. Updates controller and hardware state labels and buttons by invoking update_state_labels_and_btns() Updates homing group state by invoking update_homing_grp_state().
| msg | received controller states |
|
protected |
Makes a service request to configure a controller state.
Request issued through the configure_controller_client_. Asynchrounous call, method exits after having issued the request.
| controller | name of controller to activate |
|
protected |
callback on controller enable button
| controller | string name of controller to change state |
|
protected |
simple conversion message type conversion function
| dynamic_joint_state_in | message in |
| map_out | joint states map out |
|
protected |
Ensure the joint state broadcaster is active.
The JSB can become inactive, ensure that it comes active again.
Calls the set_controller_state() method
|
privateslot |
Tries to set the bioscara_gripper_128 hardware component to the active state and tries to enable the gripper_controller.
|
protected |
callback function called when a homing button is pressed
publishes on homing_publisher_ to initiate/stop homing
| joint | string name of joint |
| cmd | -1, 0, +1 to start homing to negative direction, stop homing, start homing to positve direction. |
|
protected |
callback on joint state update.
Updates joint_states_ with the latest values using dynamic_joint_state_msg_to_map(). Updates homing group state by invoking update_homing_grp_state().
| msg | received joint states |
|
protected |
simple conversion message type conversion function
| named_lcs_in | NamedLifecycleState message in |
| map_out | state map out |
|
override |
Automatically invoked by the RViz parent class. Initializes the panel.
Retrieves the pointer to the parent node and saves it in node_. This node and its executor is used for all clients and publishers.
Additionally a the prune_timer_ is created which periodically cleans all dangling service requests. All subscribers, publishers and clients are created and saved in their corresponding handler. Also the #controller_states_state and hardware_states_ state maps are prepopulated by invoking prepopulate_state_map()
|
protected |
Prepopulates a state map with a default NamedLifecycleState for every specified key.
This is done to avoid having to check for the existence of key when accessing the map. Keys could be missing if hardware interfaces are not specified or named differently.
For every joint the state interfaces are initialized as follows:
Some joints (the gripper) dont have all state interfaces, but they are initialized regardless.
| state_map | The state map to prepopulate |
| augment_vec | keys that are added/overwritten |
|
protected |
Prepopulates a state map with a default NamedLifecycleState for every specified key.
This is done to avoid having to check for the existence of key when accessing the map. Keys could be missing if an expected controller or hardware component has not been loaded or has a different name.
| state_map | The state map to prepopulate |
| augment_vec | keys that are added/overwritten |
|
protected |
Print life-cycle state message to console.
| prefix | string prefix |
| map_in | map to be printed |
|
protected |
calls the correct functions to bring a controller to the correct state.
Checks if configure_controller() needs to be called before switch_controllers() can be called to bring the controller to the desired state.
| controller | controller name |
| target_state | target state |
|
protected |
Set the control button state.
Sets control buttons color, text and active status based on the component state.
| button | pointer to button to modify |
| state | state of the component |
|
protected |
Makes a service request to change a hardware component state.
Request issued through the hardware_state_client_. Asynchrounous call, method exits after having issued the request.
| component | name of hardware component to modify |
| target_state | target state |
|
protected |
Set state label text and color of the homing state label.
Sets color and text of label.
| label | pointer to label |
| state | joint state |
|
protected |
Set the state label.
sets color and text based on the component state.
| label | pointer to label to modify |
| state | state of the component |
|
protected |
Makes a service request to change controller states.
Activates and deactivates a combination of controllers.
| activate_controllers | list of controllers to activate |
| deactivate_controllers | list of controllers to deactivate |
| activate_asap | if true controller switch happens in the realtime loop |
| timeout | switch timeout |
|
protected |
returns the next logical state from the current one.
| current_state | current state |
|
protected |
Enabl/Disables the homing group depending on the homing controller state.
|
protected |
updates all homing state labels.
Calls set_homing_state_label() for each joint state label.
|
protected |
updates component state label and control button.
Calls set_state_label() for state_label and set_en_btn() for en_button.
| state_map | component state map |
| state_label | pointer to state label |
| en_button | pointer to enable button |
| state_key | string key to access in state_map |
|
protected |
Update all hardware and controller state lables.
calls update_state_label_and_btn() for each controller and hardware component.
|
protected |
Subscription to the the controller_manager state publisher.
Used to retrieve information about hardware and controller state changes.
|
protected |
Service client to the "/controller_manager/configure_controller" service.
Used to request configuration and cleanup of controllers.
|
protected |
Map correlating controller name to its lifecycle_msgs/State.
Stored as NamedLifecycleState to also simply access controller name from map value.
|
protected |
Service client to the "/controller_manager/set_hardware_component_state" service.
Used to request activation and deactivation of harddware components.
|
protected |
Map correlating hardware component name to its lifecycle_msgs/State.
Stored as NamedLifecycleState to also simply access component name from map value.
|
protected |
Publisher to send commands to the homing_controller.
Used to start and stop homing of joints.
|
protected |
Subscription to the the joint state publisher state publisher.
Uses the "/dynamic_joint_states" to receive updates of all joints states.
|
protected |
Map storing all joint state interface values by each joint.
|
protected |
Pointer to the parent node. Used for access to the executor.
|
protected |
Timer triggered every 5 s to prune unanswered service requests.
|
protected |
Service client to the "/controller_manager/switch_controller" service.
Used to request activation and deactivation of controllers.
|
protected |
The QT object containing all UI elements.
Autogenerated from the "bioscara_rviz_plugin_frame.ui" file.