フィルターのクリア

Unsuccessful at reading in UDP data

2 ビュー (過去 30 日間)
Mark
Mark 2014 年 8 月 22 日
コメント済み: Geoff Hayes 2014 年 8 月 23 日
I'm attempting to use MATLAB in a hardware in the loop simulation similar to what was done in "Design and implementation of hardware-in-the-loop-simulation for UAV using PID control method" by Sufrendi et al in 2013 with an ArduPilot based autopilot.
Basically, a program called Mission Planner traditionally sends out UDP data containing commands to a flight simulator (such as XPlane or FlightGear), and the simulator sends UDP back containing simulated sensor data.
I would like to use MATLAB in the place of the flight simulator. Using RawCap as a port sniffer, I can see that UDP data is being sent to the UDP port i'm trying to read in MATLAB on the loopback IP address 127.0.0.1, but am unable to read anything in. It appears as a bunch of hexadecimal data (probably MAVlink protocol, if that's important).
MATLAB code used:
sid = udp('127.0.0.1',49000); fopen(sid); get(sid,'Status') fgetl(sid) fscanf(sid)
which returns
ans = ''
for both fgetl and fscanf.
I have also attempted to use the UDP block in simulink without success.
Any suggestions would be greatly appreciated!
  1 件のコメント
Geoff Hayes
Geoff Hayes 2014 年 8 月 23 日
Mark - I don't have the Instrument Control Toolbox so can't comment on the use of the udp object, but I have used Kevin Bartlett's simple UDP communications app from the File Exchange to capture UDP messages sent over wi-fi from an Android phone (and send UDP messages between two running sessions of MATLAB). Perhaps it is worth a look.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelopment Computer Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by