Publishing at 1kHz for haptic applications
Would it be possible to publish data at 1kHz without detrimental effects? My simulation involves a force sensor that provides some measurements in Gazebo 9. The haptic system requires higher rates so that the human operator can feel touch. The device I'm using runs its servo loop at 1kHz and I'm wondering if I can publish inside its loop. I'm using Melodic ROS 1 in Linux 18.04 LTS and C++.
Quick comment: from experience, "publishing at 1 kHz?" with ROS 1, I'd say yes, that's possible. Much faster actually, especially when publisher and subscriber are on the same host.
A challenge might be bounding jitter sufficiently to keep it usable for real-time control purposes, which it seems like you're trying to do.
Gazebo is not a deterministic application, neither is the rest of ROS 1 (and to a large extent, 2). Introducing a pub-sub pair will not make it any better.
I'd suggest to try it and see whether performance is acceptable, but in any case it will likely very much depend on factors like load (on your CPU) and "luck".
Writing a Gazebo plugin might actually be better in this case (ie: a plugin which directly communicates with your haptic device using its SDK fi). The plugin would be synced with Gazebo's internal simulation ...(more)
@gvdhoorn, it worked good. thank you.
Could you clarify what worked?
Just publishing? Did you create a Gazebo plugin? Something else?
Please post your explanation as an answer, and then accept your own answer.