Two sensors with different step sizes - SIMULINK Arduino

3 views (last 30 days)
Hello,
I want to use two different sensors with my arduino due. One of them is a LIDAR that just works good with a step size of 0.0001. The other one is a gyro-sensor that needs something about 0.03.
That's why I created an atomic subsystem for the gyro with a sample time of 0.03 and a global step size of 0.0001 for the whole simulation.
But now I remarked that the gyro doesn't work while the LIDAR is "active". As soon as I "turn on" the LIDAR, the gyro gives unrealistic values (see screenshot).
The gyro sensor works with I2C and is connected to SDL and SCL, the LIDAR uses the RX1 and TX1 serial pins of my arduino.
Do you guys have any idea how to fix my problem?
I already thinked about creating an enabled subsystem for the LIDAR sensor that is disabled every time, when the gyro sensor sends some data. But I don't know if it would work and how to realize it...
Thanks.
  2 Comments
Nakul Khadilkar
Nakul Khadilkar on 3 Dec 2020
Hello Dan,
Try to change the sample time of the LIDAR subsystem to <1ms. There might be task overruns happening on the hardware.
Dan
Dan on 3 Dec 2020
Thanks for your answer.
But the whole simulation works with a fundamental sample time of 0.0001s (so it's <1ms). The LIDAR subsystem is just a normal subsystem and should work with this fixed step size. If I change the fundamental step size to 1ms, the LIDAR doesn't work like it should... So the 0.0001s are needed

Sign in to comment.

Answers (1)

pranav ranade
pranav ranade on 20 Oct 2021
Edited: pranav ranade on 20 Oct 2021
Hello, Have you checked with Model reference block instead of atomic subsystem ?.. you can use individual model reference block which will contain models for LIDAR and GYRO sensor so that you can define individual solver and other configuration setting for both the sensors

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!