Skip to content

Commit

Permalink
Use latched publishing for robot_mode and safety_mode (#991)
Browse files Browse the repository at this point in the history
(cherry picked from commit a91021b)

Co-authored-by: Felix Exner <[email protected]>
  • Loading branch information
mergify[bot] and fmauch authored May 13, 2024
1 parent da01094 commit fe2bd62
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions ur_controllers/src/gpio_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,23 +278,19 @@ ur_controllers::GPIOController::on_activate(const rclcpp_lifecycle::State& /*pre
}

try {
auto qos_latched = rclcpp::SystemDefaultsQoS();
qos_latched.transient_local();
// register publisher
io_pub_ = get_node()->create_publisher<ur_msgs::msg::IOStates>("~/io_states", rclcpp::SystemDefaultsQoS());

tool_data_pub_ =
get_node()->create_publisher<ur_msgs::msg::ToolDataMsg>("~/tool_data", rclcpp::SystemDefaultsQoS());

robot_mode_pub_ =
get_node()->create_publisher<ur_dashboard_msgs::msg::RobotMode>("~/robot_mode", rclcpp::SystemDefaultsQoS());
robot_mode_pub_ = get_node()->create_publisher<ur_dashboard_msgs::msg::RobotMode>("~/robot_mode", qos_latched);

safety_mode_pub_ =
get_node()->create_publisher<ur_dashboard_msgs::msg::SafetyMode>("~/safety_mode", rclcpp::SystemDefaultsQoS());

auto program_state_pub_qos = rclcpp::SystemDefaultsQoS();
program_state_pub_qos.transient_local();
program_state_pub_ =
get_node()->create_publisher<std_msgs::msg::Bool>("~/robot_program_running", program_state_pub_qos);
safety_mode_pub_ = get_node()->create_publisher<ur_dashboard_msgs::msg::SafetyMode>("~/safety_mode", qos_latched);

program_state_pub_ = get_node()->create_publisher<std_msgs::msg::Bool>("~/robot_program_running", qos_latched);
set_io_srv_ = get_node()->create_service<ur_msgs::srv::SetIO>(
"~/set_io", std::bind(&GPIOController::setIO, this, std::placeholders::_1, std::placeholders::_2));

Expand Down

0 comments on commit fe2bd62

Please sign in to comment.