Clear Filters
Clear Filters

PX4 vehicle attitude data loss

6 views (last 30 days)
anil guclu
anil guclu on 28 Apr 2019
Commented: R on 20 May 2020
Dear all,
I am using Matlab 2017b 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 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.
Sincerely. untitled.jpg
  3 Comments
anil guclu
anil guclu on 14 May 2020
Yes I solve the problem. First of all I want to inform you that I have updated my Matlab to 2018b which has an easy wizard for setup with Pixhawk Cube.
The problem is caused by the SD card that the Pixhawk comes with. For me it came with a Lexar 8 Gb SD card. The problem is solved with SanDisk Extreme U3 32GB.
If you need further assistance, please do not hesitate to ask
Sincerely
R
R on 20 May 2020
you were right
tryed several diffrent sd cards ,
"sandisk extreme pro" solved the problem
thank you

Sign in to comment.

Answers (1)

islam dib
islam dib on 27 Feb 2020
Hello,
Im sorry, I can't help you.
I've a question if you could help me please.
How to save flight data like positions, attitude, rotors speed ...?
  1 Comment
anil guclu
anil guclu on 14 May 2020
First of all sorry for late response I just saw your question.
For position, you need a GPS hardware which is connected to Pixhawk Cube. Then, there is a file whose name is rc.txt in the SD card. You need to enable the flag for the GPS in the txt file. With using the library which comes with the hardware support package, you can obtain lat lon alt number of satellites etc.
For attitude, again with using the same library you can take vehicle attitude. Euler angles, quaternions , rates etc.
For rotor speed, generally, bldcs dont give feedback of their rotational speed. You can identify a relation among the PWM signal that you use to control the speed of the motor and the rotational speed of the motor. But, rotational speed of the motor can be measured via an infrared sensor. The motor can be taped with black, and a white small paper. with counting the white over time, you can measure the rotational speed of the motor and create a relation among the PWM signal and motor speed.
For data logging there is a binary logger block in the same library. the block has 2 inputs which are enable and data. I suggest to use the same data type for logging which is single. the block records the data which are connected to the data port during the enable port is high. when the enable port goes low, record stops.
Please do not hesitate to ask anything if you need for further assistance.

Sign in to comment.

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!