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

Join diydrones

Comments

  • Indeed Matt,

    if you are going to use microcontrollers/FPGAs "not supported" by RTW (real time workshop), I strongly recommend you to start to code from scratch, and use only Matlab to validate/test your algorithms with your telemetry logs.

    Héctor
  • Hector,

    Found a nice matlab embedded extended kalman example for matlab and compiled it.
    I now understand why embedded matlab may not be the right thing to use. The result was an enormous and complicated library, not a clean simple solution. I can not imagine this running on the target processor.

    It might still be the right thing to use for the flight simulator plugin so I will continue to investigate.

    Matt

    Matt
    PROCESSOR.IT
  • Pete,
    I am working with the full 40-50Hz data rate. It is critical to get as many samples as possible during acceleration from an input change. This rate might be reduced in future but for now I need all the data I can get.

    Resolution is not a big problem because the data/process is pretty noisy anyway. The filter is designed to reject the noise. A single byte of precision would do nicely if scaled well.

    I had seen the Shumai project but it looks like it only deals with position measurement (IMU). This makes the maths required quite different.

    My BIG problem is doing the partial derivatives (pde) for the extended kalman, translating it into C and getting it right.

    One track I have not investigated is Maple. Maple is a maths analysis tool. I think it can do the pde automatically, much reducing the chances of a mistake.

    Matt
  • Developer
    Matt, Do you have any idea of the update rate (more than 4Hz) that you would require ? And what resolution do you think you will want on the time stamp ?

    I'm not sure if Tim Trueman is reading this thread. I think Tim would be very interested in what you are doing.
    I hope that you have seen his Shumai project, which is designed to test Kalman filters in X-Plane.
  • Great ideas everyone.

    To begin with I will only process one axis. The required data is position (angle), velocity(rotation), servo position demand and wind/air speed. I need all of the data samples to measure gain, 4Hz samples will not work at the moment. Ideally there would also be a time stamp on the data.

    My first intention is to run the filter in a flight simulation. I can grab all the data I would wish for in the comfort of my own office running the filter in a simulation plugin. I can also vary the aircraft to see how wel lthe filter adapts.

    It would be great to compare this simulation data with real world data from different aircraft. Can you suggest a standard data format for the telemetry data. It will probably need to be an efficient data format, not text.

    I had thought of realtime workshop. This seems attractive since the filters will need to change alot. I think my chances of getting the c code right are pretty small if I do start from scratch.

    Thanks again, Matt
  • And why not to code it in C?

    I mean, I use to prototype my algorithms in Matlab, and when everything is ok, I start to code it in C (in a desktop computer) to validate it with Matlab, COUTING ON with the same resources as I will have in my microcontroller, not using any high level libraries etc

    Another option is to use RealTime WorkShop and the C code generator... but I don't recommend this option if you are going to start fom scratch.

    Good luck :P

    Héctor.
  • Matt,

    I don't think simulink is the way to go to run it on embedded, probably the embedded code generation option is the best... I have the module, but I don't know how to use it... a coworker here uses it for HVAC control, so I can ask him about it...

    You want to have the code on the GCS right? Why not communicate with a Laptop and do the processing there? you would have to store the data and process it afterwards, but I think it's not such a bad idea to start with... after that you could communicate the parameters to the GCS and to the UAV...

    I think Pete´s idea is should be your prio number 1... to ensure your code works well in a real system... after that you can worry about the other stuff....

    well, I'm going home for my girlfriends grad and I'll be back until tuesday, but If you need any help PM me or write here... ;)

    good luck,

    Ray,
  • Developer
    Matt,

    I'm wondering if we can start providing you with real telemetry data for analysis to see whether your calculations are fitting well with reality ?

    What fields of data do you need in the telemetry. The rate maximum rate of acquisition on UAV DevBoard / MatrixPilot is 4 times per second, using OpenLog.

    Pete
  • I need to get my filter into c code and running real time. At the moment it is runnning far from real time on a 2Ghz quad core. There are a few possibilities:

    1. Generate a logfile of flight data to apply to the filter. Not the best way but easy. Matlab displays data nicely.
    2. Use an existing EKF c library. Difficult and likely to fail. Everything has to be perfect. Changes are difficult.
    3. Modify the existing Matlab script to be compilable using the embeddable function subset.

    My favourite track is using 1 & 3. If I can do 3 and test using 1, it is easy to make a real time version.

    Does anyone have any better ideas on how to do this? Simulink maybe?
    Can anyone help me with converting matlab script into embeddable c?
    Is there a good thread for this somewhere else?
  • Developer
    Hi Matt, Thanks for your posts. Your simulation and progress is very interesting. Pete
This reply was deleted.