f1tenth / f1tenth_gym_ros

Containerized ROS communication bridge for F1TENTH gym environment.
MIT License
154 stars 106 forks source link

update the drive_timer update rate in Multi node #12

Closed yiqianghan closed 4 years ago

yiqianghan commented 4 years ago

Problem description:

Current behavior: updates at 20 Hz. Tries to get input from both agents, if no update from agents do previous command again. Proposed new behavior: updates at 100 Hz. Same synchronization and zero-order-hold scheme. Why? by taking commands at 20 Hz and running physics at 100 Hz visualizations etc are being displayed at 1/5th of real time If you miss a control input at 20 Hz performance suffers. Synchronization is artificial, this alleviates the aliasing problem.

Solution:

updated both the self.timer and self.drive_timer rate to 100Hz added test script (test_timer.py) that runs three simple tests: -- test_timer_fps using /tf or /odom topic -- test_drive_timer_fps using /race_info topic -- test_fps_dummy_agents, spin up a dummy agent and measure the update rate

Unittest script is placed under the same folder with scripts/gym_bridge.py To run it, open two terminals, run sudo ./docker.sh at the root directory of the project, then in the second terminal, change directory to ./script, run: python test_timer.py A sample result looks like this:

[Testcase: test_drive_timer_fps] ... ok [Testcase: test_fps_dummy_agents] ... ok [Testcase: test_timer_fps] ... ok

SUMMARY:

[ INFO] [1599144441.200788052]: rviz version 1.13.12 [ INFO] [1599144441.200849596]: compiled against Qt version 5.9.5 [ INFO] [1599144441.200864047]: compiled against OGRE version 1.9.0 (Ghadamon) [ INFO] [1599144441.209118398]: Forcing OpenGl version 0. [rviz-1] killing on exit

Note: roslaunch requires a dependency package "netifaces" which can be installed using pip.

hzheng40 commented 4 years ago

I'll run the unit tests on my side before the final merge.