Update of /cvsroot/playerstage/code/stage/libstage
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21970/libstage
Modified Files:
Tag: opengl
Makefile Makefile.am Makefile.manual model.cc model_load.cc
stage.hh stest.cc typetable.cc world.cc worldfile.cc
Log Message:
libstageplugin basic working for P-2.1
Index: stest.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/stest.cc,v
retrieving revision 1.1.2.18
retrieving revision 1.1.2.19
diff -C2 -d -r1.1.2.18 -r1.1.2.19
*** stest.cc 26 Nov 2007 06:28:16 -0000 1.1.2.18
--- stest.cc 27 Nov 2007 05:36:02 -0000 1.1.2.19
***************
*** 88,98 ****
robots[i].position->Subscribe();
! sprintf( namebuf, "%s%d.laser:0", base, i );
! //robots[i].laser = (StgModelLaser*)world.GetModel( namebuf );
! //assert(robots[i].laser);
! //robots[i].laser->Subscribe();
! sprintf( namebuf, "%s%d.ranger:0", base, i );
! robots[i].ranger = (StgModelRanger*)world.GetModel( namebuf );
assert(robots[i].ranger);
robots[i].ranger->Subscribe();
--- 88,100 ----
robots[i].position->Subscribe();
! printf( "returned %s\n", robots[i].position->Token() );
! robots[i].laser = (StgModelLaser*)
! robots[i].position->GetUnsubcribedModelOfType( "laser" );
! assert(robots[i].laser);
! robots[i].laser->Subscribe();
!
! robots[i].ranger = (StgModelRanger*)
! robots[i].position->GetUnsubcribedModelOfType( "ranger" );
assert(robots[i].ranger);
robots[i].ranger->Subscribe();
***************
*** 108,113 ****
//stg_world_set_interval_real( world, 0 );
- // StgModelLaser* laser = lasers[1];
-
while( world.RealTimeUpdate() )
// while( world.Update() )
--- 110,113 ----
***************
*** 170,244 ****
! for( int i=0; i<POPSIZE; i++ )
! {
! //robots[i].ranger->Print( NULL );
! // get some laser data
! size_t laser_sample_count = robots[i].laser->sample_count;
! stg_laser_sample_t* laserdata = robots[i].laser->samples;
! if( laserdata == NULL )
! continue;
! // THIS IS ADAPTED FROM PLAYER'S RANDOMWALK C++ EXAMPLE
! /* See if there is an obstacle in front */
! robots[i].obs = FALSE;
! for( unsigned int l = 0; l < laser_sample_count; l++)
! {
! if(laserdata[l].range < minfrontdistance)
! robots[i].obs = TRUE;
! }
! if( robots[i].obs || robots[i].avoidcount )
! {
! newspeed = 0;
! /* once we start avoiding, continue avoiding for 2 seconds */
! /* (we run at about 10Hz, so 20 loop iterations is about 2 sec) */
! if( ! robots[i].avoidcount)
! {
! robots[i].avoidcount = 15;
! robots[i].randcount = 0;
! // find the minimum on the left and right
! double min_left = 1e9;
! double min_right = 1e9;
! for( unsigned int i=0; i<laser_sample_count; i++ )
! {
! if(i>(laser_sample_count/2) && laserdata[i].range < min_left)
! min_left = laserdata[i].range;
! else if(i<(laser_sample_count/2) && laserdata[i].range <
min_right)
! min_right = laserdata[i].range;
! }
! if( min_left < min_right)
! newturnrate = -turnrate;
! else
! newturnrate = turnrate;
! }
! robots[i].avoidcount--;
! }
! else
! {
! robots[i].avoidcount = 0;
! newspeed = speed;
! /* update turnrate every 3 seconds */
! if(! robots[i].randcount)
! {
! /* make random int tween -20 and 20 */
! newturnrate = DTOR(rand() % 41 - 20);
! robots[i].randcount = 50;
! }
! robots[i].randcount--;
! }
! robots[i].position->Do( newspeed, 0, newturnrate );
! //robots[i].position->Do( 0, 0, 10 );
! }
}
//#endif
--- 170,244 ----
! // for( int i=0; i<POPSIZE; i++ )
! // {
! // //robots[i].ranger->Print( NULL );
! // // get some laser data
! // size_t laser_sample_count = robots[i].laser->sample_count;
! // stg_laser_sample_t* laserdata = robots[i].laser->samples;
! // if( laserdata == NULL )
! // continue;
! // // THIS IS ADAPTED FROM PLAYER'S RANDOMWALK C++ EXAMPLE
! // /* See if there is an obstacle in front */
! // robots[i].obs = FALSE;
! // for( unsigned int l = 0; l < laser_sample_count; l++)
! // {
! // if(laserdata[l].range < minfrontdistance)
! // robots[i].obs = TRUE;
! // }
! // if( robots[i].obs || robots[i].avoidcount )
! // {
! // newspeed = 0;
! // /* once we start avoiding, continue avoiding for 2 seconds */
! // /* (we run at about 10Hz, so 20 loop iterations is about 2 sec) */
! // if( ! robots[i].avoidcount)
! // {
! // robots[i].avoidcount = 15;
! // robots[i].randcount = 0;
! // // find the minimum on the left and right
! // double min_left = 1e9;
! // double min_right = 1e9;
! // for( unsigned int i=0; i<laser_sample_count; i++ )
! // {
! // if(i>(laser_sample_count/2) && laserdata[i].range < min_left)
! // min_left = laserdata[i].range;
! // else if(i<(laser_sample_count/2) && laserdata[i].range <
min_right)
! // min_right = laserdata[i].range;
! // }
! // if( min_left < min_right)
! // newturnrate = -turnrate;
! // else
! // newturnrate = turnrate;
! // }
! // robots[i].avoidcount--;
! // }
! // else
! // {
! // robots[i].avoidcount = 0;
! // newspeed = speed;
! // /* update turnrate every 3 seconds */
! // if(! robots[i].randcount)
! // {
! // /* make random int tween -20 and 20 */
! // newturnrate = DTOR(rand() % 41 - 20);
! // robots[i].randcount = 50;
! // }
! // robots[i].randcount--;
! // }
! // robots[i].position->Do( newspeed, 0, newturnrate );
! // //robots[i].position->Do( 0, 0, 10 );
! // }
}
//#endif
Index: model.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/model.cc,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -C2 -d -r1.1.2.15 -r1.1.2.16
*** model.cc 26 Nov 2007 06:28:16 -0000 1.1.2.15
--- model.cc 27 Nov 2007 05:36:01 -0000 1.1.2.16
***************
*** 1219,1223 ****
//glVertex2f( p2.x, p2.y );
! //printf( "tracing %.2f %.2f %.2f %.2f\n", p1.x, p1.y, p2.x, p2.y
);
//double dx = p2.x - p1.x;
--- 1219,1223 ----
//glVertex2f( p2.x, p2.y );
! printf( "tracing %.2f %.2f %.2f %.2f\n", p1.x, p1.y, p2.x, p2.y );
//double dx = p2.x - p1.x;
***************
*** 1271,1284 ****
return;
! //stg_velocity_t gvel;
! //this->GetGlostg_model_get_global_velocity( mod, &gvel );
!
! //stg_pose_t gpose;
! //stg_model_get_global_pose( mod, &gpose );
!
! // convert msec to sec
double interval = (double)world->interval_sim / 1e6;
-
//stg_pose_t old_pose;
//memcpy( &old_pose, &mod->pose, sizeof(old_pose));
--- 1271,1277 ----
return;
! // convert usec to sec
double interval = (double)world->interval_sim / 1e6;
//stg_pose_t old_pose;
//memcpy( &old_pose, &mod->pose, sizeof(old_pose));
***************
*** 1440,1442 ****
--- 1433,1454 ----
}
+ StgModel* StgModel::GetUnsubcribedModelOfType( char* modelstr )
+ {
+ printf( "searching for %s in model %s with string %s\n", modelstr, token,
typestr );
+ if( subs == 0 && (strcmp( typestr, modelstr ) == 0) )
+ return this;
+
+ // this model is no use. try children recursively
+ for( GList* it = children; it; it=it->next )
+ {
+ StgModel* child = (StgModel*)it->data;
+
+ StgModel* found = child->GetUnsubcribedModelOfType( modelstr );
+ if( found )
+ return found;
+ }
+
+ // nothing matching below this model
+ return NULL;
+ }
Index: Makefile
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/Makefile,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** Makefile 22 Nov 2007 01:42:48 -0000 1.1.2.7
--- Makefile 27 Nov 2007 05:36:01 -0000 1.1.2.8
***************
*** 163,167 ****
PIXBUF_LIBS = -L/opt/local/lib -lgdk_pixbuf-2.0 -lgobject-2.0 -lgmodule-2.0
-lglib-2.0 -lintl -liconv
PKG_CONFIG = /opt/local/bin/pkg-config
! PLAYER_CFLAGS = -I/Users/vaughan/PS-2.0/include/player-2.0
PLAYER_LIBS = -L/Users/vaughan/PS-2.0/lib -lplayercore -lltdl -lpthread
-lplayererror
RANLIB = ranlib
--- 163,167 ----
PIXBUF_LIBS = -L/opt/local/lib -lgdk_pixbuf-2.0 -lgobject-2.0 -lgmodule-2.0
-lglib-2.0 -lintl -liconv
PKG_CONFIG = /opt/local/bin/pkg-config
! PLAYER_CFLAGS = -I/Users/vaughan/PS-2.0/include/player-2.1
PLAYER_LIBS = -L/Users/vaughan/PS-2.0/lib -lplayercore -lltdl -lpthread
-lplayererror
RANLIB = ranlib
***************
*** 268,273 ****
libstage_la_LDFLAGS = -version-info 3:1:0 -rpath $(libdir)
libstage_la_LIBADD = -L/opt/local/lib -lgdk_pixbuf-2.0 -lgobject-2.0
-lgmodule-2.0 -lglib-2.0 -lintl -liconv -L/opt/local/lib -lfltk_gl -framework
AGL -framework OpenGL -lfltk -framework Carbon -framework ApplicationServices
-
- # build a stand-alone test program using libstage
stest_DEPENDENCIES = libstage.la
stest_SOURCES = stest.cc
--- 268,271 ----
Index: world.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/world.cc,v
retrieving revision 1.1.2.16
retrieving revision 1.1.2.17
diff -C2 -d -r1.1.2.16 -r1.1.2.17
*** world.cc 26 Nov 2007 06:28:16 -0000 1.1.2.16
--- world.cc 27 Nov 2007 05:36:02 -0000 1.1.2.17
***************
*** 268,272 ****
wf->ReadTupleFloat( entity, "size", 1, this->height );
!
if( this->bgrid )
delete bgrid;
--- 268,274 ----
wf->ReadTupleFloat( entity, "size", 1, this->height );
! this->paused =
! wf->ReadInt( entity, "paused", this->paused );
!
if( this->bgrid )
delete bgrid;
***************
*** 515,521 ****
list;
list = list->next )
! {
!
!
StgBlock* block = (StgBlock*)list->data;
assert( block );
--- 517,521 ----
list;
list = list->next )
! {
StgBlock* block = (StgBlock*)list->data;
assert( block );
Index: model_load.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/model_load.cc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** model_load.cc 26 Nov 2007 06:28:16 -0000 1.1.2.4
--- model_load.cc 27 Nov 2007 05:36:01 -0000 1.1.2.5
***************
*** 324,329 ****
wf->WriteTupleLength( this->id, "pose", 0, this->pose.x);
wf->WriteTupleLength( this->id, "pose", 1, this->pose.y);
! wf->WriteTupleLength( this->id, "pose", 2, this->pose.z);
! wf->WriteTupleAngle( this->id, "pose", 3, this->pose.a);
// call any type-specific save callbacks
--- 324,333 ----
wf->WriteTupleLength( this->id, "pose", 0, this->pose.x);
wf->WriteTupleLength( this->id, "pose", 1, this->pose.y);
! wf->WriteTupleAngle( this->id, "pose", 2, this->pose.a);
!
! wf->WriteTupleLength( this->id, "pose3", 0, this->pose.x);
! wf->WriteTupleLength( this->id, "pose3", 1, this->pose.y);
! wf->WriteTupleLength( this->id, "pose3", 2, this->pose.z);
! wf->WriteTupleAngle( this->id, "pose3", 3, this->pose.a);
// call any type-specific save callbacks
Index: typetable.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/typetable.cc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** typetable.cc 1 Nov 2007 07:18:53 -0000 1.1.2.4
--- typetable.cc 27 Nov 2007 05:36:02 -0000 1.1.2.5
***************
*** 6,9 ****
--- 6,13 ----
stg_typetable_entry_t typetable[] = {
+ //{ STG_MODEL_BASIC, "model", StgModel::Create },
+ //{ STG_MODEL_LASER, "laser", StgModelLaser::Create },
+ //{ STG_MODEL_POSITION, "position", StgModelPosition::Create },
+ //{ STG_MODEL_RANGER, "ranger", StgModelRanger::Create },
{ "model", StgModel::Create },
{ "laser", StgModelLaser::Create },
Index: Makefile.am
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/Makefile.am,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** Makefile.am 22 Nov 2007 01:39:04 -0000 1.1.2.5
--- Makefile.am 27 Nov 2007 05:36:01 -0000 1.1.2.6
***************
*** 19,26 ****
lib_LTLIBRARIES = libstage.la
- # TODO put this back in before release
- # build stest, a stand-alone test binary using the stage library,
- bin_PROGRAMS = stest
-
# The stage library
libstage_la_SOURCES = \
--- 19,22 ----
***************
*** 51,56 ****
libstage_la_LIBADD = @PIXBUF_LIBS@ @FLTK_LIBS@
! # build a stand-alone test program using libstage
stest_DEPENDENCIES = libstage.la
stest_SOURCES = stest.cc
stest_LDADD = libstage.la
--- 47,54 ----
libstage_la_LIBADD = @PIXBUF_LIBS@ @FLTK_LIBS@
! # build stest, a stand-alone test binary using the stage library,
! bin_PROGRAMS = stest
stest_DEPENDENCIES = libstage.la
stest_SOURCES = stest.cc
stest_LDADD = libstage.la
+
Index: Makefile.manual
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/Makefile.manual,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** Makefile.manual 17 Nov 2007 23:31:21 -0000 1.1.2.7
--- Makefile.manual 27 Nov 2007 05:36:01 -0000 1.1.2.8
***************
*** 1,44 ****
- HEADERS = \
- ../config.h \
- colors.h \
- stage.hh \
- worldfile.hh
-
- CC = g++
-
- OBS = \
- ancestor.o \
- block.o \
- blockgrid.o \
- gl.o \
- glcolorstack.o \
- logo.o \
- model.o \
- model_callbacks.o \
- model_laser.o \
- model_load.o \
- model_position.o \
- model_props.o \
- model_ranger.o \
- stage.o \
- stest.o \
- typetable.o \
- world.o \
- worldfltk.o \
- worldfile.o
-
- # worldgtk.o
! CPPFLAGS= -g -Wall -I.. -I../replace `pkg-config --cflags gtkglext-1.0`
! LIBS= `pkg-config --libs gtkglext-1.0`
-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
! all: foo
! foo : $(OBS) $(HEADERS)
! g++ -o foo $(CPPFLAGS) $(OBS) $(LIBS)
clean :
! rm -f *.o *.lo
--- 1,37 ----
+ SRC = \
+ ../config.h \
+ colors.h \
+ stage.hh \
+ worldfile.hh \
+ ancestor.cc \
+ block.cc \
+ blockgrid.cc \
+ canvas.cc \
+ glcolorstack.cc \
+ model.cc \
+ model_callbacks.cc \
+ model_laser.cc \
+ model_load.cc \
+ model_position.cc \
+ model_props.cc \
+ model_ranger.cc \
+ stest.cc \
+ stage.cc \
+ typetable.cc \
+ world.cc \
+ worldfile.cc \
+ worldgui.cc
! CXXFLAGS+= -g -Wall -I.. -I../replace `fltk-config --use-gl --cflags`
`pkg-config --cflags glib-2.0 gdk-pixbuf-2.0`
! LIBS= `fltk-config --use-gl --ldflags` `pkg-config --libs gdk-pixbuf-2.0`
-framework OpenGL
! all: stage
! stage: $(SRC)
! g++ -o $@ $(CXXFLAGS) $(SRC) $(LIBS)
clean :
! rm -f *.o *.lo stage
Index: stage.hh
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/stage.hh,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -C2 -d -r1.1.2.17 -r1.1.2.18
*** stage.hh 26 Nov 2007 06:28:16 -0000 1.1.2.17
--- stage.hh 27 Nov 2007 05:36:01 -0000 1.1.2.18
***************
*** 1430,1434 ****
coordinate. */
void LocalToGlobal( stg_pose_t* pose );
!
// this version raytraces from our local origin
stg_meters_t Raytrace( stg_radians_t angle,
--- 1430,1438 ----
coordinate. */
void LocalToGlobal( stg_pose_t* pose );
!
! /** returns the first descendent of this model that is unsubscribed
! and has the type indicated by the string */
! StgModel* GetUnsubcribedModelOfType( char* modelstr );
!
// this version raytraces from our local origin
stg_meters_t Raytrace( stg_radians_t angle,
Index: worldfile.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/worldfile.cc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** worldfile.cc 26 Nov 2007 06:28:16 -0000 1.1.2.2
--- worldfile.cc 27 Nov 2007 05:36:02 -0000 1.1.2.3
***************
*** 1408,1411 ****
--- 1408,1414 ----
{
assert( property );
+ printf( "property %s index %d value_count %d \n",
+ property->key, index, property->value_count );
+
assert(index >= 0 && index < property->value_count);
***************
*** 1649,1657 ****
{
CProperty* property = GetProperty(entity, name);
! /* TODO
! if (property < 0)
! property = InsertProperty(entity, name);
! */
! SetPropertyValue(property, index, value);
}
--- 1652,1665 ----
{
CProperty* property = GetProperty(entity, name);
!
! if( property == NULL )
! {
! /* TODO
! property = InsertProperty(entity, name);
! SetPropertyValue(property, index, value);
! */
! }
! else
! SetPropertyValue(property, index, value);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit