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 中查找有关 Network Connection and Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!