12many

  • **
  • 66
Development environment
« on: June 14, 2016, 01:57:12 am »
Hi,

I'm starting to get serious about contributing to LibrePilot.  Although I've used various versions of Unix/Linux in the past, I've been completely spoiled by Visual Studio under Windows the last decade or two.

Currently I'm using good old venerable tools like vi and grep, but my guess is there is a better way.  Are developers using a linux IDE or developing under Windows and using visual studio?

Can anyone provide some tips to get a new developer up to speed?

Thanks in advance!
--Dave

hwh

  • *
  • 1018
Re: Development environment
« Reply #1 on: June 14, 2016, 03:18:28 am »
Welcome,

The main developer manual is in the wiki at https://librepilot.atlassian.net/wiki/display/LPDOC/Developer+Manual it's somewhat incomplete for a lot of details.  If you're planning on submitting changes back to the project the instructions for getting the source code in there are wrong. The rest of setting up the development environment is correct.

The page on github at https://github.com/librepilot/LibrePilot/wiki/Git-Workflow describes how developers setting up to send pull requests with changes to the project should get and maintain a copy of the source.  No one actually works on the main copy of the source, all developers have their own copies and work on them.  When a change is ready they generate a pull request aimed at the main repository, it's reviewed by other developers, suggestions for changes are made if necessary, and once changes have been made and it's been approved by at least four other developers it's merged into the main repository.

I use vi and grep. I've used them as long as they've existed, back to early bsd and sysV unix.  In fact, I used them even when working on c# projects under Windows, I only used VS to compile.  :)

In the four months or so I've been here I haven't heard anyone mention using any IDE for anything other than GCS and that in a limited way.  I think most of the developers are on Linux, a couple on OS-X, and as far as I know, no one routinely using Windows.  You're welcome to develop on Windows if you like, it would be good to have someone using Windows routinely.  We normally hear about problems compiling on Windows from users in the forum.

I don't think VS can handle compiling with the gcc compiler in the Msys environment.  I'd also be worried that it would reformat the code.  While I'm thinking of it I should mention, project policy is no tab characters, only spaces.

Tips, lets see...

Use the force Luke...  oops, sorry, use the source Dave.  :)   Grepping through the source is probably the best way to learn.

The main makefile has a target to make html doxygen documentation for the entire source tree.

Since you're always working under git version control in your own copy of the source it's easy to make a new branch, experiment in it, and then delete it if it doesn't work or you've learned what you were experimenting to find out. I couldn't tell you how many branches I've created and thrown away like that.

You can tell it's late at night and the forums are quiet, I've rambled on quite a bit...
-Hank

12many

  • **
  • 66
Re: Development environment
« Reply #2 on: June 14, 2016, 06:31:47 am »
Thanks Hank, that's a great help.  You sound like you're an old-dog like me, although I did get seduced by the dark (windows) side and it sounds like you didnt.  However I'm seeing the light nowadays.  :)

And yeah, I agree that the best documentation is source.  I think I have a handle on how the UAVObjects XML files get converted to source code class definitions and are used for telemetry serialization.  Now I'm trying to understand if it's just my n00b status (probably) or whether LP actually supports > 8 motors... 

Thanks again for the help, I really appreciate it!
-Dave

hwh

  • *
  • 1018
Re: Development environment
« Reply #3 on: June 14, 2016, 07:20:32 am »
At the time you posted your "over 8 motors" query none of the 4 or 5 developers who were online knew the answer.  None of them had ever seen more than 8 motors.

filnet

  • *****
  • 113
Re: Development environment
« Reply #4 on: June 29, 2016, 08:50:56 am »
I use Eclipse for GCS development. With a bit of effort you can get a decent dev environment.
At this time I have code navigation and I am also able to debug GCS from within Eclipse.
I want, at some stage, to share my Eclipse project files but they are still too hardwired to my particular environment.

Alternate route, for GCS, it to use QtCreator (I don't...).

PS : about code format, you can/should run "make uncrustify_all" once in a while to format the code to the LP standard.



Re: Development environment
« Reply #5 on: June 30, 2016, 07:41:53 am »
I am mainly a firmware developer.  I use Linux Mint Mate with whatever editor I like and command line tools like:
find . \( -iname '*.c*' -o -iname '*.h' \) -exec grep -H M_PI \{\} \; | less

Be aware that xml files in shared/uavobjectdefinition are parsed and create a lot of similarly named c, cpp, and h files.  On the one hand, you won't see these created source files until you build some stuff.  On the other hand, you need to realize that they should not be modified by you.

Interesting flight code is found in flight/modules

<another old dog>

12many

  • **
  • 66
Re: Development environment
« Reply #6 on: July 07, 2016, 07:13:12 am »
Apologies for the delay & thanks for the responses.  Wasn't getting notifys and forgot to check back.

For what it's worth, I've moved over to building on Windows (since thats how you build for win32).  Using msys64 works great and allows me to use Visual Studio at least for editing.  Is anyone interested if I set up a VS project?  (its free)  It would be pretty easy to at least edit and kick off make.  Windows 10 and it's soon to arrive bash integration opens up interesting possibilities, too...

hwh

  • *
  • 1018
Re: Development environment
« Reply #7 on: July 07, 2016, 08:03:32 am »
...Is anyone interested if I set up a VS project?  (its free)  It would be pretty easy to at least edit and kick off make.  Windows 10 and it's soon to arrive bash integration opens up interesting possibilities, too...
I use VS for some commercial C# projects but I'd never use it for LP.  It's all right for someone to edit the code for themselves but for anyone needing to submit the code for merge back into the main repo it makes too much extra work. VS has a habit of reformatting code without being told to.  All that reformatting shows as changes in git, sometimes showing almost every line in a file as changed.  All those automatic changes need to be removed before merge.

The bash integration is close to worthless, I'm a windows insider (anyone can sign up) and have run it.  It generates linux executables that only run in the bash environment or on a real linux system.  Unlike cygwin and msys you can't generate windows exe files in there or even run existing windows exe files.  They've also said that it's going to be command line only, they have no intention of supporting running programs with a graphical interface.

12many

  • **
  • 66
Re: Development environment
« Reply #8 on: July 07, 2016, 08:10:47 am »
Hey Hank,

Ok, I get it...  Should have expected that.  Enough said then.