how can i recieve Mavlink message through udp connection?

5 Ansichten (letzte 30 Tage)
seongheon kim
seongheon kim am 13 Jan. 2021
Beantwortet: 胡虎虎 am 11 Nov. 2022
im really new to Mavlink and uav toolbox..
im trying to recieve Mavlink message from px4 by using udp connection.
before that , im doing some practice by making Mavlink message by myself and send it to locol
i made Attitude message and i gave a sine wave to value of 'roll' parameter. and sent to localhost (loopback)
and using udp recieve block , i could recieve the message i just sent. but the result of roll (as you can see in the scope ) dosent really change in real time...
result should be the sine wave .
i hav no idea why the value is not being update . does someone know how to solve this problem??
thank you for reading my poor english

Akzeptierte Antwort

Ankur Bose
Ankur Bose am 13 Jan. 2021
Hi,
I can see the Status outport of the Deserializer block is 0 which indicates that no new message is being received. I also see that the output data is not a smooth sine curve. All this leads me to believe that the data read size/ sample rate in the UDP receive is not appropriate.
If you are using the Instrument Control Toolbox UDP receive, I suggest you keep the data size to a large value(ex -200). Also read at a faster rate that you are writing. Use the Status outport of UDP receive to trigger a Triggered subsystem. Put the deserializer inside the trigger subsystem.
Hope that helps,
Ankur
  3 Kommentare
Ankur Bose
Ankur Bose am 15 Jan. 2021
So I recreated your model on my side with the following settings in UDP receive block.
I did not select the Enable Blocking Mode option. Below is what I see in Signal Data inspector. Top plot is sine value that you send and bottom is what you receive
You can smoothen the response further by connecting the status outport of UDP receive to a triggered subsystem and placing your deserializer inside the triggered subsystem
seongheon kim
seongheon kim am 17 Jan. 2021
thank you ! it really helped alot !

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

胡虎虎
胡虎虎 am 11 Nov. 2022
您好,我也在研究关于这方面的一个通信,请问可以提供一些参考嘛,谢谢

Kategorien

Mehr zu Get Started with Aerospace Blockset finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by