Asked by Robert
on 13 Jun 2011

Hello,

My name is Robert and I am an undergraduate student at UIUC. I am currently working on a project and was wondering whether or not Matlab would be helpful in my endeavor. Before I start fiddling around and start putting in a lot of effort into this Matlab/Simulink project I was wondering if it was worthwhile. The project idea is as follows:

I am designing a quadrotor (at the moment only a one axis balancing arm that pivots on an axle with a motor/propeller on each end of the arm). I have an encoder attached to the axle that records the actual position of the arm. I was hoping to implement a PID controller that would adjust the propeller speeds accordingly so it goes to the exact position I specify in the shortest amount of time. My question are, can I provide Matlab with real time streaming data coming from the quadrotor and the encoder and design a pretty good PID control using the control system PID toolkit and autotuner PID toolkit? Is this feasible? I can stream data coming from the quadrotor and encoder into an excel file.. What would be the best way to go about this, I am very new to MatLab and only know the basics, although I am a very avid programmer.

Thank you,

Robert

*No products are associated with this question.*

Answer by Fangjun Jiang
on 13 Jun 2011

Accepted answer

Matlab/Simulink is the right tool for your task, however, you need to understand that Matlab/Simulink mostly runs simulation on your computer, it is not fit for real-time control, especially for your task which sounds timing critical to me. There is a toolbox called xPC Target which allow you to boot your computer with RTOS and use it for real-time control. You can also use third party rapid prototype system for the real-time task. The typical procedure is that your build your controller plus your motor plant model in Matlab/Simulink environment and try-and-error your design till you get good performance. Then you can automatically generate C code, compile it and download to your real-time system (xPC target or rapid prototype) which has hardware I/O that can interface with your motor hardware.

Answer by Robert
on 13 Jun 2011

Thank you Fangjun, I like the second option you listed, rapid prototype in the simulink/matlab environment and then generate C code and try it out on my real desk model. I was playing around with simulink and I came up with a design process. Can you check if I am moving in the right direction.

I will first import my quadrotor Autocad Inventor model through sim mechanics and then run PID simulations on the model. After perfecting my model software, I will convert it to C code (which I am not to sure how its done..) and test it out on my quadrotor. What do you think?

Guy Rouleau
on 14 Jun 2011

Hi Robert... this sounds perfect. MathWorks calls this model based design.

We have many webinars you can watch to learn how this sort of thing is usually done. For example you can start here:

http://www.mathworks.com/rapid-prototyping/embedded-control-systems.html

Fangjun Jiang
on 14 Jun 2011

Answer by Suleman Shafqat
on 16 Nov 2011

Hi Robert are u done with quadrotor modeling now or not? does that C code generation approach helped u i am also doing quad rotor project.

Robert
on 25 May 2012

Answer by Zack zeko_boeing747@hotmail.com
on 23 Mar 2012

Hi guys, I was working on modelling and controlling a quad rotor flying robot. And finally I am done with the whole process. However, lately I thought of simulating the robot in a 3D trajectory plane or may be an environment to track it's path and see the differences UN-controlled and after controlling. I don't wanna write lots of complex mathematical equation to describe what I wanna do in order to make it easy for anyone to help me.

My question is simple as follows: I have 6 equations that give 6 different outputs (X Y Z theta Phi Epsi). All what I need from anyone is tell me how to connect 6 different equation with 1 block diagram that translates these outputs in a 3D space.

Regards,

Zack

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 1 Comment

## sarthak (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/9398#comment_85900

Hey robert, i am also doing the same project. Can you tell me did u make a sensor model in simulink?

If yes then how?

I am really confused

Please help!!!