Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 1516

How to setforce at a constant interval?

$
0
0
I have to write a gazebo model plugin to apply torque to a joint at a constant interval of 0.01 sec. It seems that the update rate of gazebo is 1000Hz, so I wirte the following code in OnUpdate(). This is not a good way because it's not exact 1000Hz in simulation from my testing. Is there other way to reach the goal? int count = 0; public: void OnUpdate() { if (count <= 10) this->model->GetJoint("joint")->SetForce(0,5); else if (count > 10 && count <= 20) this->model->GetJoint("joint")->SetForce(0,5); ... count++; };

Viewing all articles
Browse latest Browse all 1516

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>