hi, am a working in hardware in the loop simulation (HILS) for ardupilot mega.

the purpose of my research is to ensure that ardupilot control system works well,before I do the actual flight test.
the difference between what I do with pre-existing HILS is a model airplane that I use is a model of state space and not a model of an aircraft that already exists on xplane.

The following is an overview of its design scheme:

I have managed to describe the control block diagram for stabilization control mode from ardupilotmega.pde coding ,and compare the results between simulation control dan ardupilot hardware control. the following picture is the block diagram for stabilization control mode in matlab/simulink :

inside logitudinal block

inside lateral directional block

now, the problem is:

I have difficulty in describing the existing control algorithms ardupilotmega.pde coding  to the form of control block diagram  for auto control mode, because I do not understand the coding of the overall ardupilotmega.pde

so far, for the auto control mode, this is what I have gained:


-i a am still find a solution for make a gps simulation. now my idea is using yaw angle,speed,and inital position to estimate next position (some one help me)

-I am still trying to understand how the working process of waypoint tracking in ardupilotmega.pde coding , so that I can describe the block diagram in matlab / simulink. (some one help me)

new update (1 juni 2012)

this is my video off waypoint tracking simulation 








Views: 12756

Reply to This

Replies to This Discussion

You can use this tool to communicate between Simulink and X-plane


Hi Sufendi,

I know it's been a long time since you've completed this but I am undertaking a similar project but instead of using APM I will be utilising the Pixhawk. I still intend to model the dynamics of a system using matlab/simulink and will utilise a serial connection and mavlink up and down into matlab.

It's been difficult to find good reference material on the subject. I am wondering If you have a copy of some of the simulation code that I can look at to get an idea of what you were trying to do. At this stage I am stuck trying to get the IMU off of the pixhawk. I have been able to read data off and display it on matlab using MEX but I can't seem to work out how I can use this to transfer to a s-code for use in simulink. Perhaps your work can shed some light.

If you can I would really appreciate seeing anything you have that might help me. My email is 11306103@student.uts.edu.au

Hi Sufendi,

I am trying to connect APM planner with Matlab like you did (using"UDP Receive" & "UDP Send" blocks)  but then I dont get any data, I just get this message:

"Error in 'Conexion/UDP Receive': Received a fractional-length packet for the specified data type"

Does APM planner send data to simulink by MAVlink protocol?

I dont even know what datas are input/output in the APM planner.

i can't download the attachments.could u help me .my email is 4201100117@csu.edu.cn i have read your paper ,thank you anyway

hello sufendi, 

i can't download your attachment file, can you send to my email?


best regards.

Hi Edmond,

Did you ever figure this out? I am trying to do the same thing.



McGill U

Edmond Leong said:

Same question for the UDP data receiving from APM (pilot commands).  Question is how to configure the UDP block in Simulink in order to unpack the UDP data from APM? Thanks !

Reply to Discussion


© 2020   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service