Revision: 9054
http://playerstage.svn.sourceforge.net/playerstage/?rev=9054&view=rev
Author: jpgr87
Date: 2011-05-26 00:28:38 +0000 (Thu, 26 May 2011)
Log Message:
-----------
Changes to playernav: removed declarations from inside of assert() calls (in
case player is compiled with -DNDEBUG), and changed behavior so it exits
cleanly when connection to Player fails instead of bombing on an assertion
Modified Paths:
--------------
code/player/trunk/config/CMakeLists.txt
code/player/trunk/utils/playernav/player.c
code/player/trunk/utils/playernav/playernav.c
Modified: code/player/trunk/config/CMakeLists.txt
===================================================================
--- code/player/trunk/config/CMakeLists.txt 2011-05-25 02:39:25 UTC (rev
9053)
+++ code/player/trunk/config/CMakeLists.txt 2011-05-26 00:28:38 UTC (rev
9054)
@@ -10,6 +10,7 @@
hokuyo_aist.cfg
iwspy.cfg
joystick.cfg
+ kinect.cfg
lms400.cfg
magellan.cfg
mapfile.cfg
Modified: code/player/trunk/utils/playernav/player.c
===================================================================
--- code/player/trunk/utils/playernav/player.c 2011-05-25 02:39:25 UTC (rev
9053)
+++ code/player/trunk/utils/playernav/player.c 2011-05-26 00:28:38 UTC (rev
9054)
@@ -44,11 +44,13 @@
playerc_mclient_t* mclient;
/* Connect to Player */
- assert(mclient = playerc_mclient_create());
+ mclient = playerc_mclient_create();
+ assert(mclient);
+
for(i=0; i<num_bots; i++)
{
- assert(clients[i] =
- playerc_client_create(mclient, hostnames[i], ports[i]));
+ clients[i] = playerc_client_create(mclient, hostnames[i], ports[i]);
+ assert(clients[i]);
if(playerc_client_connect(clients[i]) < 0)
{
fprintf(stderr, "Failed to connect to %s:%d\n",
@@ -72,7 +74,8 @@
// only subscribe to the first robot's map
if(i==0)
{
- assert(maps[i] = playerc_map_create(clients[i], map_idx));
+ maps[i] = playerc_map_create(clients[i], map_idx);
+ assert(maps[i]);
if(playerc_map_subscribe(maps[i],PLAYER_OPEN_MODE) < 0)
{
fprintf(stderr, "Failed to subscribe to map\n");
@@ -81,14 +84,16 @@
}
else
maps[i] = NULL;
- assert(localizes[i] = playerc_localize_create(clients[i], 0));
+ localizes[i] = playerc_localize_create(clients[i], 0);
+ assert(localizes[i]);
if(playerc_localize_subscribe(localizes[i],PLAYER_OPEN_MODE) < 0)
{
fprintf(stderr, "Warning: Failed to subscribe to localize on robot %d;
you won't be able to set its pose.\n",i);
playerc_localize_destroy(localizes[i]);
localizes[i] = NULL;
}
- assert(planners[i] = playerc_planner_create(clients[i], planner_idx));
+ planners[i] = playerc_planner_create(clients[i], planner_idx);
+ assert(planners[i]);
if(playerc_planner_subscribe(planners[i],PLAYER_OPEN_MODE) < 0)
{
fprintf(stderr, "Warning: Failed to subscribe to planner on robot %d;
you won't be able to give it goals.\n",i);
Modified: code/player/trunk/utils/playernav/playernav.c
===================================================================
--- code/player/trunk/utils/playernav/playernav.c 2011-05-25 02:39:25 UTC
(rev 9053)
+++ code/player/trunk/utils/playernav/playernav.c 2011-05-26 00:28:38 UTC
(rev 9054)
@@ -401,13 +401,18 @@
gui_data.ports, &(gui_data.initial_zoom), &(gui_data.aa),
&map_idx, &planner_idx) < 0)
{
+ // Input problem, print usage and exit with error
puts(USAGE);
exit(-1);
}
- assert(signal(SIGINT, _interrupt_callback) != SIG_ERR);
+ if (signal(SIGINT, _interrupt_callback) ==SIG_ERR)
+ {
+ // Couldn't register signal callback, exit with error
+ exit(-1);
+ }
- assert(gui_data.mclient = init_player(gui_data.clients,
+ gui_data.mclient = init_player(gui_data.clients,
gui_data.maps,
gui_data.localizes,
gui_data.planners,
@@ -416,7 +421,12 @@
gui_data.ports,
DATA_FREQ,
map_idx,
- planner_idx));
+ planner_idx);
+ if(! gui_data.mclient )
+ {
+ // Connection to Player failed, exit with error
+ exit(-1);
+ }
// assume the robots all start enabled (should really get the current
// enable/disable state for each robot from the server).
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit