# Problem with fitness calculation in NEAT

I am working on a project in which a drone is up to learn to fly. I am using NEAT.

For the first experiment I want it to learn how to hover inside a 3x3x3 meters box. My input is 6 sensors for each direction. Output is same as in a drone so thrust (normalized to 0-1), aileron, rudder and elevator.

Initially just used a time as fitness, and after many generations it hovers inside the box. It only really learns to use the thrust in function of up and down sensors, but it never learns to react to input from other sensors because they are not directly connected to fitness.

I would like to get some ideas about a good test for my problem. Should the drone be put to fly a track with obstacles? Should I have some more input data ? Should I define fitness to better reflect good reactions for input sensor data?

Thanks in advance

NOTE: the drone uses relatively accurate physics, I am able to do tasks using a controller.

• Welcome to AI! So, if I understand the question properly, fitness evaluation is currently restricted to maintaining vertical position (up/down thrust)? – DukeZhou Sep 6 '17 at 18:20
• No, fitness is just time. The problem is that that way it favours the units that only use thrust (the spawn point is in the center of the cube), the result is that it never learns to react for input from other sensors because any species that would go out of center would need to learn to react to side sensors and counter steer but those species extinct because they crash early (much quicker than ones that hover in the middle of the box using just thrust). – smallbit Sep 6 '17 at 20:37
• thanks for the clarification. (It might be useful to include that in the text of the question...) – DukeZhou Sep 7 '17 at 17:49

## 1 Answer

Seem like time is a good fitness, though you need it to engage into learning side sensor inputs and side movement.

I would consider adding a bit of randomness to the environment. How about adding some random mild forces that might sway it left, right, front and rear a bit so that that bots are forced to use other sensors and inputs to stay in the center.

In cases when drone is not simulated, this task is a little harder but adding randomness to the environment can still be done. For example, tilt your drone a tiny amount in a random direction at random intervals. This will force your drone to learn to correct for being jostled by wind, without you having to actually produce wind.