Well, thanks for support!
So here is my application, I am currently working on: I want to build an autopilot system for RC planes/(multi-)coptors using 9DOF-AHRS at the moment, later GPS navigation.
Because I cannot try and fail, I have to use a simulation before real flight. For development I want to use a Multiplex Twinstar 2 as platform, because it is easy to handle and hard to destroy.
As simulator I am using Aerofly Professional Deluxe, with the Twinstar 2 model.
Now comes a bit of magic. A trainer-like program is reading the time, position, velocity and the orientation (attitude, heading) out of AFPDs memory, calculating sensor values for gyro, accelerometer, magnetometer and is transmitting theese data via USB serial interface to mbed.
Mbed thinks this are real sensor values. Then it is using the open source AHRS to calculate Roll, Pitch and Yaw.
Here comes at the moment a very simple "autopilot": a simple P-controller for pitch and roll. Throttle and rudder are fixed. Its output was sent back to PC, instead of servos and ESC. Then to PPJoy and PPJoy's virtual device was configured to control the plane in AFPD.
The plane in the simulator is now stabilizing itself!
The artifical horizon is stable. The richt window shows the PPJoy channels: throttle, aileron, x, x, x, elevator, rudder, x.
Hi! I have got some trouble with the compiler. My program compiles fine, but it hangs. Here is a link: http://mbed.org/users/BlazeX/code/CrashTest_AHRS/
It is using a 3D-Math library I have written years ago and used for PC-Apps. This lib I have ported to mbed and it es tested and running fine. So the lib is not the problem.I want to implement this AHRS: https://github.com/TobiasSimon/MadgwickTests/blob/master/MadgwickAHRS.c Later I will use real sensors. But now it gets fixed values.I have located the problem in the AHRS::MadgwickAHRSupdate method. If I access any variable the program hangs?!If I comment out the MadgwickAHRSupdate in the AHRS::Update method it runs. If I comment out the hole code in MadgwickAHRSupdate it runs too. But if there is any variable in this methodes accessed, the program hangs.EDIT: The problem is in the piece of code in the 2nd post.
Can someone help me please?