MATLAB Answers

Changing sample time, Ts of the examples under Simulink support package for parrot minidrones

4 views (last 30 days)
Shivam Pasricha
Shivam Pasricha on 23 Oct 2020
Edited: Nitin Kapgate on 29 Oct 2020
Hello everyone,
I am trying to get the sensor values at a particular time for the Parrot Mambo Fly minidrone. Simulink model: Code generation template.
I want to change the sample time Ts = 0.005 sec to Ts = 5.00 sec. I tried providing sample time as 5 sec in the solver but then error occurs
According to what i understood from the flight log after the simulation is that counter(returns the sensor values like pressure, altitude, acc.) occurs every second with a frequency of 200Hz as Ts is set to 5ms.
But I want the counter to occur every 5 secs.
Would be great if someone could help me here.
thanks :)

Answers (1)

Nitin Kapgate
Nitin Kapgate on 29 Oct 2020
Edited: Nitin Kapgate on 29 Oct 2020
You have changed the fixed-step solver’s step-size (system sample time) to be equal to 5 seconds, but the sample times for the blocks in the model are still 0.005 seconds, which is causing an error.
This error is caused because the sample times of different blocks must be integer multiples of fixed-step solver’s step-size. Otherwise, the simulator might miss key transitions in the state of the system.
You can resolve this error by changing the sample times (which currently are set to 0.005 seconds) for all the blocks in the model to 5 seconds or an integer multiple of 5 seconds.
Refer the documentation to learn more about sample times in systems.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!