Based upon the calculations in the paper:
ROBUST NEURAL NETWORK CONTROL OF A QUADROTOR HELICOPTER
C. Nicol,C.J.B. Macnab, A. Ramirez-Serrano
An analytical simulator was coded in Mathematica 8.x for quadcopters:
http://www.wolfram.com/cdf-player/ you need to download this free player
All four motors are at 100%:
One motor is 4% less:
The quadcopter is fully specified with all the necessary mechanical and aerodynamic parameters. So the analytical calculations are true to the physical model of an actual quadcopter. They are not general for some abstract quadcopter, they are specific to a particular make and model.
I consider the analytical simulation quite primitive and has room for much improvement. The first derivatives are treated as moving averages of second derivative differentials. The time resolution is 1/1000 s, for 3 seconds of flight which is a take-off from the ground.
The output is a tabular ASCII file made from first and second partial derivatives of the Roll, Pitch, Yaw and X, Y, Z (with regards to time) and their corresponding values. The orientation of the copter in the interactive animation is true to the analytics.
Easily turbulence, noise and off-balance forces can be added.
These files can be used to test and train NN control systems for Arducopter.
Thanks for you info... I am currently developping a Neural Network Controller for the APM based on Adaptative Neural Networks, (no PID here), its begins to work, see below:
At this moment, I need to find how to get more heap space for the neural network memory, because the APM heap is full (8k only..)
Which code base are you using? I am writing my own test routines from the NN controller papers posted earlier. These are not for production purposes but for me to learn how to NN for control systems.
Could u kindly keep me posted with the system issues for the APM board like the heap issue.
Great work, and I happy to see we are moving forward
You may download the alpha version of my Neural Network Controller v1.0c for ArduPilotMega HERE. This is a very alpha version under developpment This is a Kohonen's neural network which 3 layers, 2 inputs and 1 output. At this moment I test this by using the pole balancing problem which is a very unstable device and very close to a quadcopter...
The code works well on the ArduMega v1.4 but, due to the limited size of the Heap (8k), I am not able to use the full neural network setup (a 25x25 matrix). At this moment, the firmware is limited to a 15x17 matrix...
So, this why I need to find a mean to get more memory. I think that with the full memory this auto-adaptive network can be soon tested with the ArduPilot Mega and its IMU... If you find some means to increase and/extend the heap size they are welcome...
Here an interesting paper which describe well the Pole Balancing Problem:
A Neural Network Pole Balancer that Learns and Operates on a Real Robot in Real Time
by Dean Hougen, John Fischer, Deva Johnam - Artificial Intelligence, Robotics, and Vision Laboratory Department of Computer and Information Sciences - University of Minnesota
A neural network approach to the classic inverted pendulum task is presented. This task is the task of keeping a rigid pole, hinged to a cart and free to fall in a plane, in a roughly vertical orientation by moving the cart horizontally in the plane while keeping the cart within some maximum distance of its starting position. This task constitutes a difficult control problem if the parameters of the cart-pole system are not known precisely or are variable. It also forms the basis of an even more complex control-learning problem if the controller must learn the proper actions for successfully balancing the pole given only the current state of the system and a failure signal when the pole angle from the vertical becomes too great or the cart exceeds one of the boundaries placed on its position.
This pole balancing code can be modified to train the arducopter to fly in small indoor rooms. the turbulence off the walls and floor can be offset by the same learning NN after a few trials.
I shall give it a good study.
I keep getting .pde files from you, as opposed to .cpp , I cannot open them on IMAC, could u show me how to open them on IMAC properly?
I figured it out.... no worries
Net->KohonenLayer->Output = (double*) calloc(C, sizeof(double));
Why do you need to use double, could we use integers or even short, then all the way at the end divide by a normalization factor.
I am not sure these NN required double precision, but I will check some more. If you can reduce the double to smaller number you should be ok
Ok, why not, this will save memory space... The NNcontroller need 25x25 matrix for working well...
if calloc and malloc use the heap there is no guarantee of continuity of allocation i.e. there will be dead areas of unallocated memory between the allocations.
In the case of this code and APM, may I suggest we write our own allocation routine, that upfront allocates a large area and we calculate the addresses for the matrices we need manually.
I forgot to mention, maybe APM board should be used for what it does now, and for NN control another board with more resources can be coupled to the APM board.
One way or the other this going to happen, if the NN control becomes a serious endeavour.