Synchronize Simulink node with PX4 SITL - ROS - Gazebo
6 次查看(过去 30 天)
显示 更早的评论
Hi all,
I'm trying to synchronize my simulink model with px4 SITL ( ROS and gazebo). Is there a good way to ensure that the simulink node staying sync with ROS - Gazebo time? I'm running on ubuntu 18.04 with ROS and gazebo9, matlab 2020b.
I tried few things:
- Use pacing simulation while running the node, but it can't run at real time above 50 [Hz] (it start to shift and looses its sync after few steps). I tried to slow down the px4 SITL but it dosent ensure sync with the simulink node.
- Build the model from simulink and generate standalone ROS node: the node was very senstive to my fix-step choise - I couldn't make it perfecly sync with px4 SITL.
- Build the model from simulink and generate standalone ROS node with "enable ros time simulation stepping": it gives my a "FATAL" error when trying to run the node, unless my fix-step time is exactly the /clock frequency (even not a multiply of this frequency). Is there a way to change the /clock frequency or choose some multiply of this frequency?
Ill appreciate any help,
Thanks,
Iftach.
0 个评论
回答(2 个)
Abhijeet Gadkari
2021-5-3
Hello Iftach,
Option 3. seems the closest to achieve an almost "real-time" execution of your algorithm.
Typically setting the fixed-step size of the model to a multiple of /clock topic publish rate should be sufficient.
However, owing to the complexity of the issue, could you please contact technical support for further assistance?
Thanks.
Abhijeet
Jakobus Louw
2021-6-17
You can syncronise Gazebo and Simulink with the Gazebo Pacer block in Simulink and a GazeboPlugin (provided by MathWorks) in your world file as described in the link.
I have managed to do that by launching a .world file and running a simulink model in sync with it.
However, the Gazebo Pacer block resets time in Gazebo which causes PX4 to stop.
So I am going to try starting Gazebo first, then sync with Simulink, then connect PX4. Ill update you if it works.
Please let us know if you find a solution.
6 个评论
Diego Rojas
2021-10-28
编辑:Diego Rojas
2021-10-28
Gotcha,thanks @Jakobus Louw! The issue I am having is that when I start the simulink model + gazebo pacer, the gazebo simulation switches from unpaused to paused. Line 11 in GazeboWorldImpl.cpp seems to pause gazebo. This then effects my ros nodes such as my camera data, and stops publishing data. Curious if you ran into this issue?
Jakobus Louw
2021-10-28
编辑:Jakobus Louw
2021-10-28
I did not run into that issue.
Are you sure it pauses it? I remember when I ran Simulink with Gazebo it ran much slower than 1x speed. Maybe it just looks paused? Also, Gazebo and Simulink are then synced, but I dont know if ROS is then also synced with Gazebo
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!