Matlab/Simulink - Gazebo -Co-Simulation - rosbag
3 ビュー (過去 30 日間)
im planning to do a CO-Simulation with Matlab/Simulink and Gazebo with the ROS-Toolbox in Simulink. There is a specific tool named 'Gazebo Pacer' which synchronize Gazebo simulation with the time step of Simulink. Do you have any idea to play a rosbag under this circumstances?
For clarification. I want to play a rosbag, since i press the start button in Simulink. One approach was to add the rosbag in the launchfile which is launching the whole gazebo environment. But if i do this, the playback starts immediately. But i want to start it with the play button from Simulink. Furthermore, i couldn't figure out a way to synchronize the rosbag and the simulink timestep.
Is there a possible solution for it? Or have anyone similiar problems? Maybe there is an approach with the c++ api? I'm very interested in a solution or at least a solution suggestion...
回答 (1 件)
Cam Salzberger 2020 年 4 月 22 日
One suggestion is to use the Read Data block from ROS Toolbox in your Simulink model. This is designed to output messages for a selected topic from the rosbag, synchronized with the Simulink simulation time. You can run the output to an Enabled Subsystem with a Publish block inside. You can set up multiple Read Data + Enabled Subsystem + Publish combinations if you need multiple topics out of the rosbag.