im planning on writing code from scratch and was curious if anyone else is doing a similar thing.
Lot's of folks are writing portions of code from scratch.The current Ardupilot dev team consists of about 5-10 expert programmers and another 10-15 people contributing code. Same for multiWii and other full autopilot projects. I guess it depends on what you are trying to do. If you have an application that truly requires a complete custom application that is very different from ArduPilot or, you think the ArduPilot code is so junky it needs a full re-write ;-) it could make sense. If you want to do it as merely a learning experience you might want to start with something still challenging but a bit less ambitious like modifying the existing code to do what you want so you can achieve it in some reasonable timeframe.
BTW, I didn't mean to imply that the ArduPilot code is "junky". It is not. It's reasonably well organized and fairly well documented and makes good use of modules and libraries. As with anything there is always room for improvement but if that wasn't the case where would the fun be!
My comment: " you think the ArduPilot code is so junky it needs a full re-write" was just that, if YOU think it needs a full re-write that might be a reason but again, unless you want to do something completely different leveraging the ArduPilot code would be the best bet. Professional CompSci people are taught very early to not "re-invent the wheel".
I've written a lot of code portions to expand ArduPlane to a particular project that I'm involved, mainly to add rpm sensors and temperature sensors. I also have added more Mavlink messages to send the additional data to QGroundcontrol.
Personally, I found the system very well designed and structured and I don't recommend you to write the whole code from scratch. If you think there is something missing, you can expand the code and make it capable of doing what you want as I did. That is the most exciting and fascinating point of opensource: you can change it as you want!
One other point
Yeah I have nothing wrong with the code. Its so good I have nothing to add. I dont just want to buy a uav and assemble it. I would like to make it a project and learning experience. Is it really that complex? I was just going to do it piece by piece. Like start with just fly by wire, then telemetry, then basic mission planner, then stabilization, then like a digital fence/border then waypoints, then complex mission planner. Something like that. Start basic then just add on. I will be using the current code as a huge reference. How long do you think this will take?
The time you will take heavily depends on the experience that you have. Good programming skills and electronics knowledge are a must in this kind of challenge. In a one man effort, I think it will probably take a couple of years to achieve the current state.
Daniel, if you can't tell how complex it is from looking at the code, I suspect you should not be trying to write this stuff from scratch.
Like Pedro mentioned, it all depends on how skilled you are at programming C/C++ and what kind of physics background you have. There's more to it that just turning some motors on and off. You have to understand physics, and must be a good programmer. You also have to understand the details of microcontroller programming, in this case the Atmega.
There's no point in sitting around procrastinating about it, 90% of programming is doing. Dive in.
It's not too complicated to 'assemble' the code from scratch though. Using the existing libraries to get attitude, position, and user readings and then using that to manipulated servos outputs and what not is not too hard and a good opportunity to better understand what the devs are up to when looking at the source code. It looks a little messy and a bit hard to follow to the untrained eye (noobs like myself), but if you try and 'assemble' the code yourself, you'll quickly grow an understanding and appreciation for the structure and logic of the dev team.
This is what I've made for the sake of learning Ardupilot code:
Good luck, and happy learning.
For what ever it's worth, I'm experimenting with converting the APM2 to a sensor suite that plugs into a higher level computer (such as a gumstix overo, beagleboard, laptop, desktop, etc.) My approach is to use the "library" portion of the ArduPlane code to simplify accessing and managing all the hardware sensors, but write my own setup() and loop() functions that (for the most part) just read the hardware sensors through the library API and write the output into a straightforward binary/checksummed packet format that my actual flight computer can parse.
I have some well developed autopilot code that runs on a a linux gumstix (or just about any other posix system) but I'm in need of some sensors to test with.
I realize there are any number of ways you can combine all the possible pieces together to get a solid autopilot, and there are any number of engineering decisions and choices that we face along the way, but for me I enjoy the bigger head room that a higher end linux computer offers, so this is the route I'm taking.