This project was started in November , electronics and control loops. Because I always need a cool project to learn new things, it was clear that something that can fly had to be built.
The project started as a "tricopter-only" project, but as I wanted to build smaller vehicles with more payload capacity, I decided to make some quadrotor, hexacopter and Y6 hexacopter firmwares too. My main interest is to build very small MAVs that fly as good as larger ones (or even better) and that can be controlled by wireless video link. I also experimented with autonomous flight in GPS-denied areas (video), and with GPS assisted autonomous hover (video). It would be cool to add more features to this project but I am pretty busy with my PhD research. But maybe one day I could combine my scientific interests with my hobby projects...
-- William

Contact: Shrediquette @ g m x . d e --- All content published under CC Attribution-Noncommercial-Share Alike 3.0 Germany

29 September 2009

Matlab source code

I got a lot of requests for the matlab source code of my tracking algorithm. (If you wonder what I am talking about, watch this video of the tracking process via Matlab: http://vimeo.com/6347100 )
As you will see, it is not that complicated. I did not upload the complete source code, because that doesn't make too much sense. My GUI for example, contains a lot of code and it is most likely irrelevant to most of you. I left out the calculations of the different parameters for my PID control loop too, they will make things appear more complicated than they really are.

Here comes the code:
Matlab Tricopter Tracking

If you have questions, I would suggest that you put them into the comments for this post. Doing so, more people might benefit from it.

10 comments:

  1. Hello William Th.:

    My name is Elena and I am from Spain.
    I am a student of Engineering in Automatic and Industrial Electronics.

    I write to you because I have liked very much your work. It is really interesting. I want to do some questions to you:

    How I can design in Matlab a tool as "tricopter debug tool"?

    Might you send me more documentation about the source code complete that you have programmed in Matlab?

    The reason is that I would like in a future to be able to do a tricopter similar to your one.

    I'm sorry for my English. Regards, Elena.

    My email is: elenablas_1985@hotmail.com

    ReplyDelete
  2. Hi William,

    Thanks for sharing your work.

    I tried running your code on matlab but I can't seem to get rid of the debug message that says:

    ??? Multiple VIDEOINPUT objects cannot access the same device simultaneously.

    Error in ==> StartCam at 80
    start(vid);

    The weird thing is vid = 1x1 struct when I tried to debug it. Is there something wrong with my webcam? I'm rather new to this so I do hope you can provide some assistance.
    My email address is jaredwong2000@yahoo.com

    Thank you in advance.

    Regards
    Jared

    ReplyDelete
  3. Hi Jared,
    probably, your videoinput object is still open when you try to run the code. Try stop(vid) before you re-open the object.

    ReplyDelete
  4. Hi William,

    I am a student from Singapore. I am in Aerospace Engineering and I am looking forward to building a modified version of your tricopter. I have no knowledge in coding and my intention is to build a tricopter that will run through a circuit that is placed indoors. Which means, your method using matlab is the best idea. Would you mind sending me more details on this as to how I can go about starting on this?
    my email is sahulhs@hotmail.com.

    P.S. I will be sure to credit you in my work. :)

    ReplyDelete
  5. Hi,

    I tried running your code and experienced these errors that say:

    Index exceeds matrix dimensions.

    Error in StartCam (line 24)
    vid = videoinput('winvideo', 2,
    info.DeviceInfo(1,2).SupportedFormats{5});

    May I know how to solve this?

    Thank you very much

    ReplyDelete
    Replies
    1. Hi,
      well, on my laptop, I had two cameras, and I wanted to use camera nr.2 with image resolution setting nr.5. You need to run imaqhwinfo first to find all cameras that Matlab detected on your system, and to find the supported resolution formats.

      Delete
  6. hi william,
    i am student from indonesia. I just liked the aeromodeling world, in particular is tricopter UAV UAV Quadcopter and, in particular again is Tricopter. I have no knowledge in coding Matlab and my intention is to build a tricopter. How to create a simulation for stability and attitude on Tricopter with Matlab, the method you use matlab is the best idea. Will you send me more details about this, how can I create a 3D simulation plot that could exercise control over these Tricopter with Matlab simulation?
    my e-mail : rudy14k@gmail.com
    sorry if my english is not good.

    ReplyDelete
  7. Hi William
    I have 2 questions:
    1.I want to know what software you use to design 3d object of tricopter?
    2. How you import that object object to matlab
    Thanks

    ReplyDelete
    Replies
    1. Hi,
      you can use whatever 3D CAD tool (e.g. Rhinoceros) that is capable of exporting data as STL. This can be imported to Matlab (search for STL in the Matlab file exchange website).

      Delete