UAV School Project



Here is a quick vid of my final project I'm building in electrical engineering. It's a tricopter UAV with thrust vectoring. As of now I have implemented roll, pitch stabilization, yaw and height are controlled by the aircraft. I just control the x and y movement.


All the control algorithms use fuzzy logic. Why? To be different... and to overcome a lot of the limitations associated with PID's and nonlinear processes.


The craft has 3 motors, and 5 servos. The front two motors can pitch forward and backward as well as tilt side to side. The rear motor can only tilt side to side. This allows the aircraft to gimbal around with out having to have translational movement (in theory). The goal is to have the platform as stable as possible for photography so the servos are needed to thrust vector. (It may have been easer to have a floating camera mount...)


I use two dsPIC33s for the computer and a XBee Pro for data transfer. Both chips are running at 80MHz, one handles all the low level control while the other is for higher level control/communications. Eventually it will be used for path planning/ object avoidance etc. But now it just mainly handles communications and reading the GPS data.

 

More videos of it during the development stage are also on my youtube page.

 

Enjoy

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • Hi  Mark Arnott,

    thanks for the reply. Currently i am doing my final year project and my supervisor cant seem to help me at all.Hence, i have to do all by myself.I have very little knowledge in both programming and uav.That makes my life even more difficult.After doing so much research and reading of forums, i came across this particular post by you which i found to be very useful and will definitely help in my project.

    I would really appreciate if i could take a look at your fuzzy codes.I just want to see how you implement in C codes and insert into the main codings for uav.

    If possble,could you please send to my email @ mylifeherlifeourlives@gmail.com 


    Currently, i am using the codes found here https://github.com/TMRh20/XBoxControllerRCSerial/blob/master/MultiW...

  • Hi Ned,

    The downfall of fuzzy logic is you can't mathematically find parameters from a system model like you can with linear processes and PID control loops. That said with fuzzy logic it is more intuitive. eg:

    flying too low and still going down -> pull up really hard

    flying too low-> pull up.

    flying low but already going up -> maintain

    The values used depend on the system. a lot of playing around.  typically you fly it manually and observe what you do then convert that into parameters your code can use.

    My fuzzy code uses a center of gravity type of weighting to rseolve multiple input conditions.

    Not sure how to post code on here and have it look formated 

  • Hi Mark Arnott,

    Currently i am doing the similar project as you on fuzzy logic in uav. However, i am facing some obstacles with fuzzy logic programming. what i am doing now is using conditonal if then P = certain values. ( eg. if errorangle>-10) p=+10).I am not sure what values to be used for my errorangle and the corresponding P value. 

    If possible, is it possible to send me your fuzzy c codes for reference?Thanks.

    *fyi.I am using audrino pro mini ATmega 328 board.Thanks.

  • yes, it will work
  • Sebastian Gralla, how can I make a Turnigy Plush work faster than 50Hz?
    Can I change the PWM period lower than 20ms and it will works?
  • I'm having the same problem... it won't change much to use a faster loop if my ESC works on 50Hz...
    For altitude, I would use only sonar for lower altitude and for higher altitude pressure + accel integration.
    You can use a lowpass filter on the pressure to minimize the accel error caused because of the double integration and use a simple PID or something better to control.
  • Servos work up to 50Hz, that's correct. ESCs can work much faster, most are capable of about 1kHz, turnigy's can do faster (I heard of 4.7kHz).

     

    control loop for altitude can run slower (about 10Hz is enough), if you have all those sensors, try to combine them, use accelerometer for smoothing, sonar for low altitudes and barometer for high altitudes

  • I have a few Q's regarding using a faster loop rate.  Don't the servos and ESC PWM only run at speeds from 20-50 Hz?  If that is the case I wouldn't really be controlling the craft faster, just doing more calculations to get a better estimation of the crafts orientation/position.   Is this the correct line of thinking or not?  My IMU sensors can handle faster, but my ultrasound will only do 40Hz.  What do you suggest for altitude, a decent ultrasonic rangefinder or use a pressure sensor or integrate my accelerometer's z axis rotated into the correct frame of reference?

    Thanks for the input

     

  • 50Hz is too slow for a stable multirotor

    you have enough cpu power, i would go for 500Hz

  • I've written my own flight 3d simulator from first principles in C# that works quite will and have mainly used that to built up my initial algorithms. I then do some tuning with the craft tethered.  As you can see, I need to spend a more time tuning.  I have not used simulink at all.  It is good and all but I have a bad taste from it crashing/being unstable for other lab work (matlab that is) so that's why I'm staying away from it.  I wrote my own fuzzy controller in C. well I've written everything in C except for the sensor fusion code used by the IMU, that was open source.  It uses a nonlinear algorithm that the author has shown works better than the standard kalman filter.  I have plenty of real time left to work with.  The main loop is operating at only 50Hz.

     

    I do realize the height is unstable.  Towards the end of the vid it isn't as bad, the biggest issues are from the ultrasound sensor.   I've had major problems with it but due to having to present the project in 3 days to the school I don't have time to get a replacement. (false readings, slow, can't detect the ground when low and noisy) I had to get it working with what I had.  Will do more work on it during my own time to make much needed improvements.

     

    As for the ESC, they are Turnigy plush 25

     

This reply was deleted.