diff --git a/ur_robot_driver/src/hardware_interface.cpp b/ur_robot_driver/src/hardware_interface.cpp index a8ce0b69b..74c841ca4 100644 --- a/ur_robot_driver/src/hardware_interface.cpp +++ b/ur_robot_driver/src/hardware_interface.cpp @@ -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(tool_voltage)); using ParityT = std::underlying_type::type; @@ -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(parity)); int baud_rate; @@ -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(baud_rate)); int stop_bits; @@ -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(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); }