Wednesday, 10 March 2010

Player/Stage on Eclipse

Today I've found myself trying to set up Eclipse as my IDE for Player/Stage after moving some files and somehow deleting all the settings. I'm using an Eclipse specifically for C/C++ development, which you can get here: http://www.eclipse.org/downloads/

This is how I set it up for Player/Stage:


Open up Eclipse and select Project (from the top menubar) then Properties. Select the C/C++ Build >> settings from the left sidebar. Tool Settings should be the default tab that is open.
You should now have a window that looks like this (click to enbiggen):



Under the GCC C++ Compiler select the Miscellaneous tab and paste into the "other flags" box:
`pkg-config --cflags playerc++`




Similarly, under the GCC C Compiler select the Miscellaneous tab and paste into the "other flags" box:
`pkg-config --cflags playerc`

To set up the linker (which is what connects the object files together into a working binary which can then be executed) select the Miscellaneous tab under the GCC C++ Linker and into the Linker flags box paste:
`pkg-config --libs playerc++`

If you want to develop in C rather than C++ then paste `pkg-config --libs playerc` into the box instead.



It will probably work now if you have the PATH set on your computer properly. It didn't work for me so I told Eclipse where to look for all the Player libraries. Under the GCC C++ Compiler select the directories tab and paste the location of the folder containing the player headers. On my computer this was /usr/local/include/player-3.0/libplayerc++ it will probably be different on different computers. Do the same for the directories tab in the GCC C Compiler section.



Congratulations. You can now start working on some Player/Stage code in Eclipse! If you need to test your code it is still necessary to start a Stage simulation by opening a terminal and running $ player yourcfg.cfg. Then when you hit run in eclipse it'll compile and then start running your code on that simulation.

8 comments:

  1. Hi, I'm having trouble following these instructions. I don't have the same setup where the "C/C++ Build" is visible. I tried eclipse 3.2 and eclipse galileo 3.5. Do I have to intall some plugin to get these options? What verison of eclipse do you have and can you tell me of any other possible software/package that I may need (I'm using Ubuntu v8). Thanks

    ReplyDelete
  2. Hi Hussain, I use the CDT version of eclipse that's optimised for C/C++ development. Since all the coding I ever do is in Player/Stage it's better for my work that the normal java eclipse.
    You can download this version from here:

    http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR2/eclipse-cpp-galileo-SR2-linux-gtk.tar.gz

    Or go to the eclipse downloads page here: http://www.eclipse.org/downloads/ and install the C/C++ IDE.

    ReplyDelete
  3. Thank you for your work~!^^
    I could set up my IDE for player/stage.
    JaeGon From Korea~

    ReplyDelete
  4. hi, have u worked on map building or localization of robot .. i need help in implementing the same .. or how to implement the existing vfh , amcl and wavefront drivers.
    thx in advance
    prithvi

    ReplyDelete
  5. Hi Jenny, thanks for this small tutorial, it helped me a lot,
    regards from Germany!
    Jose

    ReplyDelete
  6. Thank you for your sharing, Jenny. Your Player/Stage manual is helpful, too ;-)

    Regards from Hong Kong,
    Kelvin

    ReplyDelete
  7. Thank you from Berlin Germany.

    Best regards.
    Max

    ReplyDelete