@@ -53,6 +53,7 @@ HardwareInterface::HardwareInterface()
5353 , joint_positions_{ { 0 , 0 , 0 , 0 , 0 , 0 } }
5454 , joint_velocities_{ { 0 , 0 , 0 , 0 , 0 , 0 } }
5555 , joint_efforts_{ { 0 , 0 , 0 , 0 , 0 , 0 } }
56+ , joint_temperatures_{ { 0 , 0 , 0 , 0 , 0 , 0 } }
5657 , standard_analog_input_{ { 0 , 0 } }
5758 , standard_analog_output_{ { 0 , 0 } }
5859 , joint_names_(6 )
@@ -358,6 +359,8 @@ bool HardwareInterface::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_hw
358359 new realtime_tools::RealtimePublisher<ur_dashboard_msgs::RobotMode>(robot_hw_nh, " robot_mode" , 1 , true ));
359360 safety_mode_pub_.reset (
360361 new realtime_tools::RealtimePublisher<ur_dashboard_msgs::SafetyMode>(robot_hw_nh, " safety_mode" , 1 , true ));
362+ joint_temperatures_pub_.reset (
363+ new realtime_tools::RealtimePublisher<ur_extra_msgs::JointTemperatures>(robot_hw_nh, " joint_temperatures" , 1 ));
361364
362365 // Set the speed slider fraction used by the robot's execution. Values should be between 0 and 1.
363366 // Only set this smaller than 1 if you are using the scaled controllers (as by default) or you know what you're
@@ -466,6 +469,7 @@ void HardwareInterface::read(const ros::Time& time, const ros::Duration& period)
466469 readBitsetData<uint64_t >(data_pkg, " actual_digital_output_bits" , actual_dig_out_bits_);
467470 readBitsetData<uint32_t >(data_pkg, " analog_io_types" , analog_io_types_);
468471 readBitsetData<uint32_t >(data_pkg, " tool_analog_input_types" , tool_analog_input_types_);
472+ readData (data_pkg, " joint_temperatures" , joint_temperatures_);
469473
470474 extractRobotStatus ();
471475
@@ -477,6 +481,7 @@ void HardwareInterface::read(const ros::Time& time, const ros::Duration& period)
477481 transformForceTorque ();
478482 publishPose ();
479483 publishRobotAndSafetyMode ();
484+ publishJointTemperatures (time);
480485
481486 // pausing state follows runtime state when pausing
482487 if (runtime_state_ == static_cast <uint32_t >(rtde_interface::RUNTIME_STATE::PAUSED))
@@ -713,6 +718,27 @@ void HardwareInterface::publishPose()
713718 }
714719}
715720
721+ void HardwareInterface::publishJointTemperatures (const ros::Time& timestamp)
722+ {
723+ if (joint_temperatures_pub_)
724+ {
725+ if (joint_temperatures_pub_->trylock ())
726+ {
727+ joint_temperatures_pub_->msg_ .header .stamp = timestamp;
728+ joint_temperatures_pub_->msg_ .joint_names .clear ();
729+ joint_temperatures_pub_->msg_ .temperatures .clear ();
730+
731+ for (size_t i = 0 ; i < joint_names_.size (); i++)
732+ {
733+ joint_temperatures_pub_->msg_ .joint_names .push_back (joint_names_[i]);
734+ joint_temperatures_pub_->msg_ .temperatures .push_back (joint_temperatures_[i]);
735+ }
736+
737+ joint_temperatures_pub_->unlockAndPublish ();
738+ }
739+ }
740+ }
741+
716742void HardwareInterface::extractRobotStatus ()
717743{
718744 using namespace rtde_interface ;
0 commit comments