Revision: 6819
http://playerstage.svn.sourceforge.net/playerstage/?rev=6819&view=rev
Author: rtv
Date: 2008-07-08 12:05:52 -0700 (Tue, 08 Jul 2008)
Log Message:
-----------
preparing tests
Modified Paths:
--------------
code/stage/trunk/libstage/CMakeLists.txt
code/stage/trunk/libstage/stage.hh
code/stage/trunk/libstage/test.cc
code/stage/trunk/worlds/fasr.world
Removed Paths:
-------------
code/stage/trunk/libstage/stest.cc
Modified: code/stage/trunk/libstage/CMakeLists.txt
===================================================================
--- code/stage/trunk/libstage/CMakeLists.txt 2008-07-08 18:28:03 UTC (rev
6818)
+++ code/stage/trunk/libstage/CMakeLists.txt 2008-07-08 19:05:52 UTC (rev
6819)
@@ -61,15 +61,11 @@
OUTPUT_NAME stage
)
-target_link_libraries( stagebinary
- stage
-)
+target_link_libraries( stagebinary stage )
-add_executable( test test.cc )
-target_link_libraries( test stage )
+add_executable( stagetest test.cc )
+target_link_libraries( stagetest stage )
-add_executable( stest stest.cc )
-target_link_libraries( stest stage )
INSTALL(TARGETS stagebinary stage
RUNTIME DESTINATION bin
@@ -79,4 +75,4 @@
INSTALL(FILES stage.hh option.hh worldfile.hh
DESTINATION include/${PROJECT_NAME}-${V_MAJOR}.${V_MINOR})
-ADD_TEST( test1 ${EXECUTABLE_OUTPUT_PATH}stage ../worlds/fasr.world)
+ADD_TEST( test1 ${EXECUTABLE_OUTPUT_PATH}stagetest )
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2008-07-08 18:28:03 UTC (rev 6818)
+++ code/stage/trunk/libstage/stage.hh 2008-07-08 19:05:52 UTC (rev 6819)
@@ -37,14 +37,7 @@
library
*/
-/**
- \defgroup libstage libstage: the Stage Robot Simulation Library
- Here is where I describe libstage for the developer.
-
- */
-/[EMAIL PROTECTED]/
-
#include <unistd.h>
#include <stdint.h> // for portable int types eg. uint32_t
#include <assert.h>
@@ -2620,6 +2613,4 @@
}; // end namespace stg
-/[EMAIL PROTECTED]/
-
#endif
Deleted: code/stage/trunk/libstage/stest.cc
===================================================================
--- code/stage/trunk/libstage/stest.cc 2008-07-08 18:28:03 UTC (rev 6818)
+++ code/stage/trunk/libstage/stest.cc 2008-07-08 19:05:52 UTC (rev 6819)
@@ -1,161 +0,0 @@
-/////////////////////////////////
-// File: stest.c
-// Desc: Stage library test program
-// Created: 2004.9.15
-// Author: Richard Vaughan <[EMAIL PROTECTED]>
-// CVS: $Id: stest.cc,v 1.3 2008-02-01 03:11:02 rtv Exp $
-// License: GPL
-/////////////////////////////////
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "stage.hh"
-using namespace Stg;
-
-//#include "config.h"
-
-double minfrontdistance = 0.750;
-double speed = 0.400;
-double turnrate = M_PI/3.0;
-
-typedef struct
-{
- StgModelLaser* laser;
- StgModelPosition* position;
- StgModelRanger* ranger;
- //StgModelFiducial* fiducial;
- //StgModelBlobfinder* blobfinder;
-} robot_t;
-
-#define VSPEED 0.4 // meters per second
-#define WGAIN 1.0 // turn speed gain
-#define SAFE_DIST 0/8 // meters
-#define SAFE_ANGLE 0.3 // radians
-
-int main( int argc, char* argv[] )
-{
- //printf( "%s %s benchmarker\n", PACKAGE, VERSION );
-
- if( argc < 3 )
- {
- puts( "Usage: stest <worldfile> <number of robots>" );
- exit(0);
- }
-
- const int POPSIZE = atoi(argv[2] );
-
- // initialize libstage
- Stg::Init( &argc, &argv );
- //StgWorld world;
- StgWorldGui world(800, 700, "Stage Benchmark Program");
-
- world.Load( argv[1] );
-
- char namebuf[256];
- robot_t* robots = new robot_t[POPSIZE];
-
- for( int i=0; i<POPSIZE; i++ )
- {
- const char* base = "r";
- sprintf( namebuf, "%s%d", base, i );
- robots[i].position = (StgModelPosition*)world.GetModel( namebuf
);
- assert(robots[i].position);
- robots[i].position->Subscribe();
-
- // robots[i].laser = (StgModelLaser*)
-// robots[i].position->GetUnsubscribedModelOfType(
MODEL_TYPE_LASER );
-// assert(robots[i].laser);
- //robots[i].laser->Subscribe();
-
- // robots[i].fiducial = (StgModelFiducial*)
- // robots[i].position->GetUnsubscribedModelOfType(
"fiducial" );
- // assert(robots[i].fiducial);
- // robots[i].fiducial->Subscribe();
-
- robots[i].ranger = (StgModelRanger*)
- robots[i].position->GetUnsubscribedModelOfType(
MODEL_TYPE_RANGER );
- assert(robots[i].ranger);
- robots[i].ranger->Subscribe();
-
- // robots[i].blobfinder = (StgModelBlobfinder*)
- // robots[i].position->GetUnsubscribedModelOfType(
"blobfinder" );
- // assert(robots[i].blobfinder);
- // robots[i].blobfinder->Subscribe();
- }
-
- // start the clock
- //world.Start();readltime //puts( "done" );
-
- while( 1 )
- if( world.Update() )
- // if( world.Update() )
- for( int i=0; i<POPSIZE; i++ )
- {
-
- //continue;
-
- StgModelRanger* rgr = robots[i].ranger;
-
- if( rgr->samples == NULL )
- continue;
-
- // compute the vector sum of the sonar ranges
- double dx=0, dy=0;
-
- for( unsigned int s=0; s< rgr->sensor_count;
s++ )
- {
- double srange = rgr->samples[s];
-
- dx += srange * cos(
rgr->sensors[s].pose.a );
- dy += srange * sin(
rgr->sensors[s].pose.a );
- }
-
- if( dy == 0 )
- continue;
-
- if( dx == 0 )
- continue;
-
- assert( dy != 0 );
- assert( dx != 0 );
-
- double resultant_angle = atan2( dy, dx );
- double forward_speed = 0.0;
- double side_speed = 0.0;
- double turn_speed = WGAIN * resultant_angle;
-
- int forward = rgr->sensor_count/2 -1 ;
- // if the front is clear, drive forwards
- if( (rgr->samples[forward-1] > SAFE_DIST/5.0) &&
- (rgr->samples[forward ] >
SAFE_DIST) &&
- (rgr->samples[forward+1] >
SAFE_DIST/5.0) &&
- (fabs( resultant_angle ) <
SAFE_ANGLE) )
- {
- forward_speed = VSPEED;
- }
-
- // // send a command to the robot
- // stg_velocity_t vel;
- // bzero(&vel,sizeof(vel));
- // vel.x = forward_speed;
- // vel.y = side_speed;
- // vel.z = 0;
- // vel.a = turn_speed;
-
- //printf( "robot %s [%.2f %.2f %.2f %.2f]\n",
- //robots[i].position->Token(), vel.x, vel.y,
vel.z, vel.a );
-
- // uint32_t bcount=0;
- //stg_blobfinder_blob_t* blobs =
robots[i].blobfinder->GetBlobs( &bcount );
-
- //printf( "robot %s sees %u blobs\n",
robots[i].blobfinder->Token(), bcount );
-
- robots[i].position->SetSpeed( forward_speed,
side_speed, turn_speed );
- }
-
-
- delete[] robots;
- exit( 0 );
-}
Modified: code/stage/trunk/libstage/test.cc
===================================================================
--- code/stage/trunk/libstage/test.cc 2008-07-08 18:28:03 UTC (rev 6818)
+++ code/stage/trunk/libstage/test.cc 2008-07-08 19:05:52 UTC (rev 6819)
@@ -214,6 +214,8 @@
// }
- while(true)
- world.Update();
+ for( unsigned long i=0; i<1000; i++ )
+ world.Update();
+
+ return 0; // success
}
Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world 2008-07-08 18:28:03 UTC (rev 6818)
+++ code/stage/trunk/worlds/fasr.world 2008-07-08 19:05:52 UTC (rev 6819)
@@ -7,7 +7,7 @@
include "sick.inc"
interval_sim 100 # simulation timestep in milliseconds
-interval_real 10 # real-time interval between simulation updates in
milliseconds
+interval_real 0 # real-time interval between simulation updates in
milliseconds
paused 1
# configure the GUI window
@@ -54,7 +54,7 @@
define autorob pioneer2dx
(
- sicklaser( pose [ 0.040 0 0 0 ] samples 180 range_max 5 laser_return 2 )
+ sicklaser( pose [ 0.040 0 0 0 ] samples 32 range_max 5 laser_return 2 )
ctrl "fasr"
#camera( pose [ 0 0 0 0 ] width 100 height 100 horizfov 70 vertfov 40 yaw 0 )
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit