Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions ur_robot_driver/src/hardware_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ CallbackReturn URPositionHardwareInterface::on_activate(const rclcpp_lifecycle::
// parameter is only evaluated, when the parameter "use_tool_communication" is set to TRUE.
// Then, this parameter is required.}
tool_voltage = std::stoi(info_.hardware_parameters["tool_voltage"]);

RCLCPP_INFO(rclcpp::get_logger("URPositionHardwareInterface"), "Tool voltage: '%d'", tool_voltage);
tool_comm_setup->setToolVoltage(static_cast<urcl::ToolVoltage>(tool_voltage));

using ParityT = std::underlying_type<urcl::Parity>::type;
Expand All @@ -329,6 +329,7 @@ CallbackReturn URPositionHardwareInterface::on_activate(const rclcpp_lifecycle::
// Note: This parameter is only evaluated, when the parameter "use_tool_communication"
// is set to TRUE. Then, this parameter is required.
parity = std::stoi(info_.hardware_parameters["tool_parity"]);
RCLCPP_INFO(rclcpp::get_logger("URPositionHardwareInterface"), "Tool parity: '%d'", parity);
tool_comm_setup->setParity(static_cast<urcl::Parity>(parity));

int baud_rate;
Expand All @@ -338,6 +339,8 @@ CallbackReturn URPositionHardwareInterface::on_activate(const rclcpp_lifecycle::
// Note: This parameter is only evaluated, when the parameter "use_tool_communication"
// is set to TRUE. Then, this parameter is required.
baud_rate = std::stoi(info_.hardware_parameters["tool_baud_rate"]);
RCLCPP_INFO(rclcpp::get_logger("URPositionHardwareInterface"), "Tool baud rate: '%d'", baud_rate);

tool_comm_setup->setBaudRate(static_cast<uint32_t>(baud_rate));

int stop_bits;
Expand All @@ -347,24 +350,30 @@ CallbackReturn URPositionHardwareInterface::on_activate(const rclcpp_lifecycle::
// Note: This parameter is only evaluated, when the parameter "use_tool_communication"
// is set to TRUE. Then, this parameter is required.
stop_bits = std::stoi(info_.hardware_parameters["tool_stop_bits"]);
RCLCPP_INFO(rclcpp::get_logger("URPositionHardwareInterface"), "Tool stop bits: '%d'", stop_bits);

tool_comm_setup->setStopBits(static_cast<uint32_t>(stop_bits));

int rx_idle_chars;
float rx_idle_chars;
// Number of idle chars for the RX unit used for tool communication. Will be set as soon as the UR-Program on the
// robot is started. Valid values: min=1.0, max=40.0
//
// Note: This parameter is only evaluated, when the parameter "use_tool_communication"
// is set to TRUE. Then, this parameter is required.
rx_idle_chars = std::stoi(info_.hardware_parameters["tool_rx_idle_chars"]);
rx_idle_chars = std::stof(info_.hardware_parameters["tool_rx_idle_chars"]);
RCLCPP_INFO(rclcpp::get_logger("URPositionHardwareInterface"), "Tool receive idle chars: '%f'", rx_idle_chars);

tool_comm_setup->setRxIdleChars(rx_idle_chars);

int tx_idle_chars;
float tx_idle_chars;
// Number of idle chars for the TX unit used for tool communication. Will be set as soon as the UR-Program on the
// robot is started. Valid values: min=0.0, max=40.0
//
// Note: This parameter is only evaluated, when the parameter "use_tool_communication"
// is set to TRUE. Then, this parameter is required.
tx_idle_chars = std::stoi(info_.hardware_parameters["tool_tx_idle_chars"]);
tx_idle_chars = std::stof(info_.hardware_parameters["tool_tx_idle_chars"]);
RCLCPP_INFO(rclcpp::get_logger("URPositionHardwareInterface"), "Tool transmit idle chars: '%f'", tx_idle_chars);

tool_comm_setup->setTxIdleChars(tx_idle_chars);
}

Expand Down