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.
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.
Hello William Th.:
ReplyDeleteMy 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
Hi William,
ReplyDeleteThanks 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
Hi Jared,
ReplyDeleteprobably, your videoinput object is still open when you try to run the code. Try stop(vid) before you re-open the object.
Hi William,
ReplyDeleteI 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. :)
Hi,
ReplyDeleteI 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
Hi,
Deletewell, 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.
hi william,
ReplyDeletei 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.
Hi William
ReplyDeleteI 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
Hi,
Deleteyou 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).
Thanks a lot
DeleteHi, William.
ReplyDeleteI am a senior researcher at MIT and try to understand quadrotors.
Your code really helped me after few hours of browsing the net.
However, I am still confused about how to use the PID to control the robot. For example, should I use PID for each motor?
Unfortunately, it seems that you code miss exactly this part, above "%Here I am putting all parameters together....".
For example, the variable senden_roll varialble is undefined. Or am I just missing something?
Thanks in advance
Danny
Hi Danny, if you need more information, please write an email.
Delete