How to increase frequency of /diagnostics topic published by epos_hardware node?
Dear ROS community,
I am using the epos_hardware ROS package as a hardware interface between an effort controller and a EPOS2 motor controller coupled with a Maxon EC90 motor. The set up is working properly and I am able to control the motor using ROS control by sending torque commands to the controller manager. I am trying to interface Simulink with ros_control by sending torque commands directly from the controller in Simulink to ros_control and hence I need real time feedback of the motor's anglular position.
The Problem: This angular position is published by the epos_hardware node on the /diagnostics topic in the diagnostics_msgs/DiagnosticArray message form with the frequency of one message per second. I need atleast 100 or 1000 messages per second and hence I want to increase frequency of the /diagnostics topic.
Solution Attempt: I went through the epos_hardware package and found the snippet of code inside the epos_hardware_node.cpp file which according to me is setting the frequency of the diagnostics topic. :
ros::Rate controller_rate(50);
ros::Time last = ros::Time::now();
while (ros::ok()) {
robot.read();
ros::Time now = ros::Time::now();
cm.update(now, now-last);
robot.write();
last = now;
robot.update_diagnostics();
controller_rate.sleep();
I have tried changing the controller_rate but that does not seem to affect the frequency of the topic at all. Am I thinking in the right direction or is there something else I should be looking at? I would like to request anyone who can guide me how to increase frequency of the /diagnostics topic.
P.S. : I have already tried using the Simulink Pacer block to try and reduce the speed of its execution but any further decrease in sampling will affect the controller performance.
Any help would be greatly appreciated! Thanks in advance!