# 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()) {
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!

edit retag close merge delete

Sort by » oldest newest most voted

Just answering this one, to hopefully help someone in the future. So as far as I remember, the diagnostics topic is not the right topic to use as feedback for any system and should be strictly used for troubleshooting only. It also has got nothing to do with ros::Rate mentioned in the question.

In the end we ended up using a joint_state_controller node to provide feedback on the /joint_states topic. One thing to remember while using ROS control with hardware driver commands is that, driver commands have limitations in terms of communication latency and the frequency of the entire loop cannot be increased beyond a certain limit. For our case the peak was about 10-20 Hz.

more

1

In the end we ended up using a Joint State Publisher

you mean a joint_state_controller, correct?

One thing to remember while using ROS control with hardware driver commands is that, driver commands have limitations in terms of communication latency and the frequency of the entire loop cannot be increased beyond a certain limit. For our case the peak was about 10-20 Hz.

this is not something I recognise, so either this is something specific to your setup or something specific to the EposHardwarehardware_interface implementation.

( 2019-06-21 07:16:15 -0500 )edit

Yes thank you! I have edited my response from Joint State Publisher to Joint State Controller.

You are right, second point is specific to the EposHardware hardware interface package. Thanks.

( 2019-06-25 05:05:55 -0500 )edit

## Stats

Seen: 115 times

Last updated: Jun 25