Redesign?

I feel like a redesign of the code to be more object-oriented would be a good idea.

I've spent a while looking at it, trying to make changes that would make it follow a track better (mainly estimating wind from the difference between the ground speed/track and air speed/heading, and I feel like it could be made a lot more understandable and extensible.

So I plan to start from scratch, except for the sensor libraries that are already written. I'm hoping to start a discussion on design here. How do you see an autopilot laid out, conceptually?

The idea of this design is to be object-oriented, such that individual components can be easily rewritten and to maximize code re-use. At the moment, I see a few places where code is redundant.

I feel like an object-oriented approach with a thought-out approach with a lot of attention paid to the naming scheme and clarifying what units variables are in and clarifying what various equations are doing (for example, I had a tough time with longitude scaling, especially since it was being used to scale longitude up in some places and scaling latitude down in others) would help people dive into coding for APM.

 

So again, any thoughts? If you could break down an autopilot into components conceptually, how would you do it?

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

Join diydrones

Email me when people reply –

Replies

  • I'm also just getting started with arduino, but I am fairly familiar with c++. I understand that there are some limitations, comparing writing a program for a modern desktop computer and writing a program for a 16-bit, 16 mhz microcontroller with no FPU and limited memory.

    Before I dive into this, I'm wondering if it's written the way it is for this reason. Is there a technical limitation preventing ardupilot from being a well-laid-out OO program? I see that the sensor libraries being used are OO.

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…