Hi All,

As part of my project on Hardware in loop simulation with APM, I am trying to use mission planner as an intermediate tool for communicating between APM and Matlab. I am essentially trying to replace the role of flightgear/xplane with Matlab. 

I am using UDP read function in Matlab to read in the control commands from mission planner. But the values I receive in Matlab are different from the values I see in the mission planner (for e.g when the normalized control command is 1.0 in mission planner, I get 1.872 in Matlab and for -1 it is -1.872) and the data is consistent for the different controls. I tried many things but could not figure out why this anomaly happens.

The data that is sent to the UDP port from mission planner is itself different as I verified this by capturing the UDP packets directly from the port using wireshark. From this I verified that Matlab correctly reads the data from the port and the problem is with the data itself. When I convert the hexadecimal data captured from the port to a decimal value I get the same value as I read in Matlab. One more interesting thing which I found was that the same data when sent to flightgear from mission planner is read correctly in flightgear (1 in mission planner is read as 1 in flightgear). I am unable to understand why same data sent to an UDP port is read correctly by flightgear and not by Matlab.

It would very helpful to me if someone who has done something similar could share their experience.

Devaprakash

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hello Devaprakash

    Were you able to resolve the data exchange problem? 

    I am trying to connect MATLAB with Mission Planner as well and I have a few problems (I dont know the which input/output data are exchanged) nor I can receive anything.

    Are you using "UDP Receive" in xPC target? Do you use any additional block to reat-time synchronize it? Isn't it in MAVlink protocol?

    I know these are a lot of questions but there are very few people who I can ask these to.

  • Developer

    radians?

    • Hi Oborne,

      Thanks for your reply, but I don't think it is a conversion issue because the input I am reading in is a normalized control input ranging from -1 to 1. 

      Devaprakash

This reply was deleted.

Activity