How to prevent Simulink Pacer from resetting ROS time?
1 回表示 (過去 30 日間)
古いコメントを表示
Following this tutorial I was able to get co-simulation running: https://it.mathworks.com/help/robotics/examples/perform-co-simulation-between-simulink-and-gazebo.html
There is however a major inconvenience as the Simulink pacer block only allows 2 options on simulation start:
- Reset Gazebo Simulation time
- Reset Gazebo Simulation time and state
I would like it to not reset anything at all, as I am working with an elaborate pipeline of ROS nodes which requires time to be monotonic and consistent with Gazebo, used to simulate sensor data.
I have actually already made a fix, by modifying the C++ source code of the Simulink Gazebo Plugin. I simply commented out where the world time is reset and it worked. It would be nice if you were to add it as a a third built in option.
Please let me know if this is not possible and maybe if I shouldn't be doing this at all or there is another way to do it without changing the plugin code.
Thanks,
Bye
Sebastian
AMZ Racing - Driverless Control
1 件のコメント
Jakobus Louw
2021 年 6 月 17 日
Thank you so much for this. It helped me a lot. I needed to simulate PX4 with Gazebo and use a Simulink ROS node as a controller.
For those coming accross this same problem, edit the file in your GazeboPlugin folder: GazeboPlugin/src/gazeboserver/GazeboWorldImpl.cpp
Comment out the line in the resetTime() function like this:
void GazeboWorldImpl::resetTime() {
// return m_world->ResetTime();
}
Then go to the GazeboPlugin/build folder and run
make
to rebuild the plugin.
回答 (1 件)
Amrtanshu Raj
2021 年 4 月 20 日
Hi,
So the objective of the Gazebo Cosim feature is to design your logic in Simulink and the use Gazebo as a physics engine to simulate your robot. The idea is not to interface Simulink with ROS network but directly to Gazebo.
If you want to use Simulink as a node in a ROS network, you can check out the ROS Toolbox which aims to achieve the functionality you need.
Hope this helps.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Gazebo Co-Simulation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!