Synchronize Simulink node with PX4 SITL - ROS - Gazebo

조회 수: 20(최근 30일)
Iftach Naftaly
Iftach Naftaly 2021년 4월 1일
편집: Jakobus Louw 2021년 10월 28일
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:
  1. 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.
  2. 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.
  3. 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.

답변(2개)

Abhijeet Gadkari
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
  댓글 수: 1
Iftach Naftaly
Iftach Naftaly 2021년 5월 3일
I'll contact the technical support.
Thank you.

댓글을 달려면 로그인하십시오.


Jakobus Louw
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
Jakobus Louw
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!

Translated by