Adding a driver to Player

From The Player Project

Revision as of 23:41, 30 January 2011 by Rmattes (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

These are rough directions for adding a new driver to the CVS source-tree for Player/Stage.

Other HowTos/Tutorials explaining other aspects of writing and building a Player 2.0 driver:

Player and Automake

Migrating from Player 1.6 to Player 2.0

How to write a player plugin driver

Very good tutorial that describes in detail how to write a new driver


Although this example is for a "roboteq" driver it should work for other drivers.

"..." in a code block means lines were omitted for clarity.

o.k., I have created a patch file for the changes made to the Player source tree in order to add my new Roboteq driver. Only glitch is that the patch does not include the two new files or the new directory:

i.e.;

position/
	roboteq/
		roboteq.cc
		Makefile.am

here is the process:

1. cvs checkout of Player source (a cvs checkout and build is its own process; check Player FAQs for more info)

2. drop the directory for the new driver ("roboteq" -- position2d) in "player/server/drivers/position/" with its appropriately edited roboteq.cc (removed the extern "C" Extra stuff for building a shared object, otherwise same as the plugin driver).

3. add a new entry in "player/configure.ac":

...
dnl Create the following Makefiles (from the Makefile.ams)
AC_OUTPUT(Makefile
...
server/drivers/position/roboteq/Makefile
...


4. add a new entry in "player/server/drivers/position/Makefile.am":

...
SUBDIRS = isense microstrain vfh ascension bumpersafe lasersafe nav200 nd roboteq
...


5. add new entries in "player/server/libplayerdrivers/driverregistry.cc":

...
#ifdef INCLUDE_ROBOTEQ
void roboteq_Register (DriverTable* table);
#endif
...
#ifdef INCLUDE_ROBOTEQ
  roboteq_Register(driverTable);
#endif
...


6. add new entry in "player/acinclude.m4":

...
PLAYER_ADD_DRIVER([roboteq],[yes],[],[],[])
...


7. create "player/server/drivers/position/roboteq/Makefile.am":

AM_CPPFLAGS = -Wall -I$(top_srcdir)
noinst_LTLIBRARIES =
if INCLUDE_ROBOTEQ
noinst_LTLIBRARIES += libroboteq.la
endif
libroboteq_la_SOURCES = roboteq.cc


8. run the usual

./bootstrap
./configure
./make && make install

if you want to make sure this worked

9. from the top-level source directory (player/)

cvs diff -u > registernewdriver.patch

to make a patch file of any existing files that have changed. Check out the patch file to see if its in good shape. Mine had a bunch of ? marks at the top, listing new files cvs did not know about because they had not been added, so I cleaned it up a bit. Otherwise it should show the changes in all the files that were modified (above).

10. cvs did not allow me to add any files to the repository without having write-privileges:

$ cvs add roboteq
cvs [server aborted]: "add" requires write access to the repository

so I just uploaded a tar.gz of the new directory with the patch file to patch tracker - don't know if there is a better way.

Personal tools