How to prevent Simulink Pacer from resetting ROS time?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Jakobus Louw
am 17 Jun. 2021
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.
Antworten (1)
Amrtanshu Raj
am 20 Apr. 2021
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 Kommentare
Siehe auch
Kategorien
Mehr zu Network Connection and Exploration finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!