User software additions/modifications

I’m new to ArduPlane, and for some applications I have in mind for the Pixhawk 2.1 (e.g., communication with external sensors), I’m told I need to consider adding user software. I am unable to find anything about this subject via Google.

How does one add user software to a Pixhawk-based UAV using ArduPlane? Where do the modifications/extensions reside? How does one preserve these software additions when updating to a later version of ArduPlane? If my questions make no sense, that just illustrates my need to a pointer to a suitable guide or tutorial on the subject!

Thanks,
Grant

It sounds like you want to “Contribute to the ArduPlane code.” The people who develop and maintain the software are called “Developers.” So I would direct you to the “Dev” section of the documentation for answers to your questions (linked below) especially the subsection on Contributing code.
http://ardupilot.org/dev/index.html

As you suggest, I don’t know of any specific “tutorial” but if you go through the process and feel the code would benefit from such a tutorial, I have no doubt the developers would welcome you authoring one!

Welcome to the community!

Thanks for your reply. While I’m not opposed to contributing, my initial priority was simply to implement customizations for my own specialized purposes. For example, I might have a specialized sensor that I want to communicate with the PixHawk via a particular physical port (telem, adc, i2c, etc.), and I might in particular want the data from that sensor to be included in a tlog. If I’m understanding correctly, I would need to add code to ArduPlane to make those things happen, and there might be changes necessary on the ground station end as well. I really have no idea what needs to be done nor where/how to do it; hence my question. BTW, I’m a competent programmer (C, Python, etc.); I’m just completely unfamiliar with the ArduPlane software environment.

new developers are welcome. First step is to learn to build and load the firmware from source on your board.
Then if you have developer oriented questions, you may find that gitter is the best place to ask questions:


please do your own research first though, and only ask if you get really stuck.
Cheers, Tridge

From the two answers I’ve gotten so far, I’m starting to get the sense that there’s no such thing as local “user software” that one can implement for one’s own specialized purposes without modifying the core ArduPlane distribution – is this correct? I’m thinking of the model some other software packages use where it is possibly to define local functions that can be hooked into the main program without modifying the core software. And if you then update the core software, the local add-ons are preserved.

The approach depends on what you’re trying to achieve. eg. if you want to talk to a sensor, then you must use the AP_HAL API as otherwise your software could request access on a bus at the same time as another thread tries to access the same bus. You’d end up crashing.

Unfortunately, I have no idea what the AP_HAL API is. Pointers to a tutorial overview page would be helpful. It doesn’t appear to me that any of this is designed to permit easy customizations for simple applications by ArduPlane non-experts.

It was posted earlier, Welcome to the ArduPilot Development Site — Dev documentation is the link you want. It really is simple and they have put a lot together to make it easier for people to start helping out.

You basically take a fork of the ardupilot firmware, you use the information on the site above (it tells you the Git info you need). You learn to compile the code as it is, then add simple things to the code and how to test it without risking a real airframe till your code is ready.

I’ve recently started and I’ve so far submitted two pull requests (so two changes to master) and the dev’s have been really helpful. You don’t have to submit the changes you make, you can keep them in your own repository but if you ever release or sell a product with the software being used you are obligated to make the code available.

Plus why not release it for the benefit of everyone else, if you plan to use an item my guess is there are others who would like it too. If we all take a view of I only want it for me, then the project as a whole would never go forwards. Remember the huge number of hours that have been expended to get the code base to where it is now, your work would be on top of that.

1 Like

All good points. Nevertheless, I can see now that there are a lot more steps involved than simply editing a text file somewhere and recompiling, so I’ll probably have to wait until the need becomes more urgent (and I have time).
Thanks!

It really is easy, it takes you step by step what you have to do. If you have a free evening one night (2 to 3 hours) you’ll be up and running and compiling the current code - even quicker if your lucky. Another night and your making your first change and testing it in SITL (software in the loop).

I’d encourage to you to try. Sure it’s not a 5 min thing to get setup but since you’re a programmer then you’d understand its not a 5 min thing to get setup and compile a complex project…

1 Like

Now that I’ve gotten over my preconceived ideas about what might/should be possible without diving deeply into understanding the ArduPlane code base, I can see that the documentation tree pointed out by a hunt0r and cbrk1 is actually pretty complete and understandable, and I imagine that I can work through it when the time comes.

I appreciate all the responses and apologize for being a bit obtuse.

Grant

1 Like