Skip to content

Commit

Permalink
deactivate hwif from write
Browse files Browse the repository at this point in the history
  • Loading branch information
krmihaly committed Oct 20, 2023
1 parent 93c619e commit 947fca3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kuka_rox_hardware_interface/src/rox_hardware_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ return_type KukaRoXHardwareInterface::write(
const rclcpp::Time &,
const rclcpp::Duration &)
{
if (lifecycle_state_.id() == lifecycle_msgs__msg__State__PRIMARY_STATE_INACTIVE) {
return return_type::OK;
}
// If control is not started or a request is missed, do not send back anything
if (!msg_received_) {
return return_type::OK;
Expand Down Expand Up @@ -320,14 +323,14 @@ return_type KukaRoXHardwareInterface::write(
rclcpp::get_logger(
"KukaRoXHardwareInterface"),
"Encoding of control signal to out_buffer failed.");
throw std::runtime_error("Encoding of control signal to out_buffer failed.");
return return_type::DEACTIVATE;
}

if (udp_replier_->SendReply(out_buff_arr_, encoded_bytes) !=
Socket::ErrorCode::kSuccess)
{
RCLCPP_ERROR(rclcpp::get_logger("KukaRoXHardwareInterface"), "Error sending reply");
throw std::runtime_error("Error sending reply");
return return_type::DEACTIVATE;
}
return return_type::OK;
}
Expand Down

0 comments on commit 947fca3

Please sign in to comment.