Revision: 6885 http://playerstage.svn.sourceforge.net/playerstage/?rev=6885&view=rev Author: jeremy_asher Date: 2008-07-17 21:30:23 +0000 (Thu, 17 Jul 2008)
Log Message: ----------- stage: added player plugin test, added CMake options to toggle building plugin and plugin tests Modified Paths: -------------- code/stage/trunk/CMakeLists.txt code/stage/trunk/libstageplugin/CMakeLists.txt code/stage/trunk/libstageplugin/p_driver.cc code/stage/trunk/libstageplugin/p_fiducial.cc code/stage/trunk/libstageplugin/p_speech.cc code/stage/trunk/worlds/simple.cfg Added Paths: ----------- code/stage/trunk/libstageplugin/test/ code/stage/trunk/libstageplugin/test/CMakeLists.txt code/stage/trunk/libstageplugin/test/lsp_test.cc Modified: code/stage/trunk/CMakeLists.txt =================================================================== --- code/stage/trunk/CMakeLists.txt 2008-07-17 21:22:33 UTC (rev 6884) +++ code/stage/trunk/CMakeLists.txt 2008-07-17 21:30:23 UTC (rev 6885) @@ -10,6 +10,8 @@ # minimum version of Player to build the plugin SET( MIN_PLAYER 2.1.0 ) +OPTION (BUILD_PLAYER_PLUGIN "Build Player plugin" ON) +OPTION (BUILD_LSPTEST "Build Player plugin tests" OFF) cmake_minimum_required( VERSION 2.4 FATAL_ERROR ) @@ -59,7 +61,6 @@ MESSAGE (STATUS "pkg-config not found, skipping Player plugin") ENDIF (PKGCONFIG) - # find FLTK and set flags FIND_PROGRAM (FLTKCONFIG NAMES fltk-config) IF (FLTKCONFIG) @@ -107,9 +108,9 @@ ADD_SUBDIRECTORY(assets) ADD_SUBDIRECTORY(worlds) -IF ( PLAYER_FOUND ) +IF ( BUILD_PLAYER_PLUGIN AND PLAYER_FOUND ) ADD_SUBDIRECTORY(libstageplugin) -ENDIF ( PLAYER_FOUND ) +ENDIF ( BUILD_PLAYER_PLUGIN AND PLAYER_FOUND ) # generate a cpack config file used to create packaged tarballs Modified: code/stage/trunk/libstageplugin/CMakeLists.txt =================================================================== --- code/stage/trunk/libstageplugin/CMakeLists.txt 2008-07-17 21:22:33 UTC (rev 6884) +++ code/stage/trunk/libstageplugin/CMakeLists.txt 2008-07-17 21:30:23 UTC (rev 6885) @@ -1,3 +1,4 @@ +MESSAGE( STATUS "Building Player plugin" ) link_directories( ${PLAYER_LIBDIR} ) include_directories( ${PLAYER_INCLUDE_DIRS}) @@ -26,6 +27,10 @@ ) +IF (BUILD_LSPTEST) + ADD_SUBDIRECTORY(test) +ENDIF (BUILD_LSPTEST) + INSTALL(TARGETS stageplugin LIBRARY DESTINATION lib ) Modified: code/stage/trunk/libstageplugin/p_driver.cc =================================================================== --- code/stage/trunk/libstageplugin/p_driver.cc 2008-07-17 21:22:33 UTC (rev 6884) +++ code/stage/trunk/libstageplugin/p_driver.cc 2008-07-17 21:30:23 UTC (rev 6885) @@ -568,6 +568,7 @@ for( int i=0; i<(int)this->devices->len; i++ ) { Interface* interface = (Interface*)g_ptr_array_index( this->devices, i ); + assert( interface ); switch( interface->addr.interf ) Modified: code/stage/trunk/libstageplugin/p_fiducial.cc =================================================================== --- code/stage/trunk/libstageplugin/p_fiducial.cc 2008-07-17 21:22:33 UTC (rev 6884) +++ code/stage/trunk/libstageplugin/p_fiducial.cc 2008-07-17 21:30:23 UTC (rev 6885) @@ -68,11 +68,7 @@ assert( fids ); pdata.fiducials_count = fidmod->fiducial_count; - - //printf( "reporting %d fiducials\n", - // fcount ); - - pdata.fiducials = new player_fiducial_item_t[pdata.fiducials_count]; + pdata.fiducials = new player_fiducial_item_t[pdata.fiducials_count]; for( int i=0; i<(int)pdata.fiducials_count; i++ ) { Modified: code/stage/trunk/libstageplugin/p_speech.cc =================================================================== --- code/stage/trunk/libstageplugin/p_speech.cc 2008-07-17 21:22:33 UTC (rev 6884) +++ code/stage/trunk/libstageplugin/p_speech.cc 2008-07-17 21:30:23 UTC (rev 6885) @@ -81,9 +81,6 @@ mod->Say( pcmd->string ); - this->driver->Publish(this->addr, resp_queue, - PLAYER_MSGTYPE_RESP_ACK, - PLAYER_SPEECH_CMD_SAY); return( 0 ); } else Added: code/stage/trunk/libstageplugin/test/CMakeLists.txt =================================================================== --- code/stage/trunk/libstageplugin/test/CMakeLists.txt (rev 0) +++ code/stage/trunk/libstageplugin/test/CMakeLists.txt 2008-07-17 21:30:23 UTC (rev 6885) @@ -0,0 +1,10 @@ +MESSAGE( STATUS "Building Player plugin tests" ) + +pkg_search_module( PLAYERC REQUIRED playerc ) + +SET( lspTestSrcs + lsp_test.cc +) + +add_executable( lsp_test ${lspTestSrcs} ) +target_link_libraries( lsp_test PLAYERC ) Added: code/stage/trunk/libstageplugin/test/lsp_test.cc =================================================================== --- code/stage/trunk/libstageplugin/test/lsp_test.cc (rev 0) +++ code/stage/trunk/libstageplugin/test/lsp_test.cc 2008-07-17 21:30:23 UTC (rev 6885) @@ -0,0 +1,42 @@ +#include <stdio.h> + +#include <libplayerc/playerc.h> + +int main(int argc, const char **argv) +{ + int i; + playerc_client_t *client; + playerc_position2d_t *position2d; + + // Create a client and connect it to the server. + client = playerc_client_create(NULL, "localhost", 6665); + if (0 != playerc_client_connect(client)) + return -1; + + // Create and subscribe to a position2d device. + position2d = playerc_position2d_create(client, 0); + if (playerc_position2d_subscribe(position2d, PLAYER_OPEN_MODE)) + return -1; + + // Make the robot spin! + if (0 != playerc_position2d_set_cmd_vel(position2d, 0, 0, DTOR(40.0), 1)) + return -1; + + for (i = 0; i < 200; i++) + { + // Wait for new data from server + playerc_client_read(client); + + // Print current robot pose + printf("position2d : %f %f %f\n", + position2d->px, position2d->py, position2d->pa); + } + + // Shutdown + playerc_position2d_unsubscribe(position2d); + playerc_position2d_destroy(position2d); + playerc_client_disconnect(client); + playerc_client_destroy(client); + + return 0; +} Modified: code/stage/trunk/worlds/simple.cfg =================================================================== --- code/stage/trunk/worlds/simple.cfg 2008-07-17 21:22:33 UTC (rev 6884) +++ code/stage/trunk/worlds/simple.cfg 2008-07-17 21:30:23 UTC (rev 6885) @@ -18,7 +18,7 @@ ) # Create a Stage driver and attach position2d and laser interfaces -# to the model "robot1" +# to the model "r0" driver ( name "stage" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit