I am using Matlab 2018b and my pixhawk cube. I have no problem with compiling simulink model, generating new firmware, uploding it to PX4, running it, logging data to an SD card, and look them at the end.
Here is my problem. I use a Simulink block named as vehicle attitude block which is placed in Sensors and Actuators library of Pixhawk Target Blocks. I set sampling time of my model and the vehicle attitude block as 1/250 s, (4ms). I just log quaternion and uORB TS time values. I run the code on PX4 without any problem. When I look at the log, I realised a delay that the time difference at uORB TS time values. Normally it increases with 4ms values, but sometimes the time difference is 200ms. which really affects my work. Please find the uORB TS time difference values in the attachment. you can see the data losses at 117th 190th 271st 406th 460th 542nd 569th seconds. 271st, 460th and 542th ones about 100ms the others about 180-200msec.
My solver is discrete, fixed step typed. Alternatively, I tried the uORB read block from the library which using the vehicle attitde message. Same thing happened again. I tried lots of sampling time values, even with different sampling times with vehicle attitude block and the main step size.
Do you have any idea how can i overcome that issue? I also wonder, are there anyone who encounter with the same error like this.
I have a request to those of you who use PX4 with simulink that could you please log quaternion or angular rate data and uORB Ts time data for 5 minutes and check the time tag differences of uORB time.
It has a crucial importance for me, I am looking forward for your answers.