Permalink
Browse files

API changes! removed the Stg prefix from all class names, and renamed…

… some key classes, eg. Stg::stg_pose_t is now Stg::Pose
  • Loading branch information...
rtv
rtv committed Jan 5, 2009
1 parent 2b31d43 commit 3680786ba7d9c1fff520f358493c1cddecd49b0c
Showing with 3,319 additions and 3,367 deletions.
  1. +15 −18 examples/ctrl/fasr.cc
  2. +2 −2 examples/ctrl/lasernoise.cc
  3. +4 −4 examples/ctrl/sink.cc
  4. +5 −5 examples/ctrl/source.cc
  5. +10 −10 examples/ctrl/wander.cc
  6. +11 −11 examples/libstage/stest.cc
  7. +9 −9 libstage/ancestor.cc
  8. +29 −29 libstage/block.cc
  9. +7 −7 libstage/blockgrid.cc
  10. +24 −24 libstage/blockgroup.cc
  11. +86 −83 libstage/canvas.cc
  12. +2 −2 libstage/gl.cc
  13. +6 −6 libstage/main.cc
  14. +533 −552 libstage/model.cc
  15. +702 −646 libstage/model.hh
  16. +14 −14 libstage/model_blinkenlight.cc
  17. +22 −22 libstage/model_blobfinder.cc
  18. +4 −4 libstage/model_callbacks.cc
  19. +15 −15 libstage/model_camera.cc
  20. +27 −27 libstage/model_fiducial.cc
  21. +31 −32 libstage/model_laser.cc
  22. +62 −90 libstage/model_load.cc
  23. +35 −35 libstage/model_position.cc
  24. +11 −11 libstage/model_props.cc
  25. +315 −315 libstage/model_ranger.cc
  26. +3 −3 libstage/model_wifi.cc
  27. +2 −2 libstage/region.cc
  28. +5 −5 libstage/region.hh
  29. +4 −4 libstage/resource.cc
  30. +5 −5 libstage/stage.cc
  31. +695 −752 libstage/stage.hh
  32. +25 −25 libstage/stage_internal.hh
  33. +20 −20 libstage/test.cc
  34. +16 −16 libstage/typetable.cc
  35. +1 −1 libstage/waypoint.cc
  36. +485 −484 libstage/world.cc
  37. +49 −49 libstage/worldgui.cc
  38. +2 −2 libstageplugin/p_fiducial.cc
  39. +1 −1 libstageplugin/p_graphics3d.cc
  40. +2 −2 libstageplugin/p_gripper.cc
  41. +2 −2 libstageplugin/p_laser.cc
  42. +1 −1 libstageplugin/p_localize.cc
  43. +3 −3 libstageplugin/p_map.cc
  44. +2 −2 libstageplugin/p_position.cc
  45. +1 −1 libstageplugin/p_ptz.cc
  46. +4 −4 libstageplugin/p_simulation.cc
  47. +10 −10 worlds/benchmark/expand.cc
View
@@ -29,37 +29,34 @@ double need[4][4] = {
typedef struct
{
- StgModelPosition* pos;
- StgModelLaser* laser;
- StgModelRanger* ranger;
- StgModelBlobfinder* blobfinder;
-
- StgModel *source, *sink;
-
+ ModelPosition* pos;
+ ModelLaser* laser;
+ ModelRanger* ranger;
+ ModelBlobfinder* blobfinder;
+ Model *source, *sink;
int avoidcount, randcount;
-
int work_get, work_put;
} robot_t;
-int LaserUpdate( StgModel* mod, robot_t* robot );
-int PositionUpdate( StgModel* mod, robot_t* robot );
+int LaserUpdate( Model* mod, robot_t* robot );
+int PositionUpdate( Model* mod, robot_t* robot );
// Stage calls this when the model starts up
-extern "C" int Init( StgModel* mod )
+extern "C" int Init( Model* mod )
{
robot_t* robot = new robot_t;
robot->work_get = 0;
robot->work_put = 0;
- robot->pos = (StgModelPosition*)mod;
+ robot->pos = (ModelPosition*)mod;
- robot->laser = (StgModelLaser*)mod->GetModel( "laser:0" );
+ robot->laser = (ModelLaser*)mod->GetModel( "laser:0" );
assert( robot->laser );
robot->laser->Subscribe();
- robot->ranger = (StgModelRanger*)mod->GetModel( "ranger:0" );
+ robot->ranger = (ModelRanger*)mod->GetModel( "ranger:0" );
assert( robot->ranger );
//robot->ranger->Subscribe();
@@ -95,7 +92,7 @@ extern "C" int Init( StgModel* mod )
}
// inspect the laser data and decide what to do
-int LaserUpdate( StgModel* mod, robot_t* robot )
+int LaserUpdate( Model* mod, robot_t* robot )
{
// get the data
uint32_t sample_count=0;
@@ -178,7 +175,7 @@ int LaserUpdate( StgModel* mod, robot_t* robot )
robot->avoidcount = 0;
robot->pos->SetXSpeed( cruisespeed );
- stg_pose_t pose = robot->pos->GetPose();
+ Pose pose = robot->pos->GetPose();
int x = (pose.x + 8) / 4;
int y = (pose.y + 8) / 4;
@@ -208,9 +205,9 @@ int LaserUpdate( StgModel* mod, robot_t* robot )
return 0;
}
-int PositionUpdate( StgModel* mod, robot_t* robot )
+int PositionUpdate( Model* mod, robot_t* robot )
{
- stg_pose_t pose = robot->pos->GetPose();
+ Pose pose = robot->pos->GetPose();
//printf( "Pose: [%.2f %.2f %.2f %.2f]\n",
// pose.x, pose.y, pose.z, pose.a );
@@ -21,7 +21,7 @@ double simple_normal_deviate( double mean, double stddev )
}
// process the laser data
-int LaserUpdate( StgModelLaser* mod, void* dummy )
+int LaserUpdate( ModelLaser* mod, void* dummy )
{
// get the data
uint32_t sample_count=0;
@@ -36,7 +36,7 @@ int LaserUpdate( StgModelLaser* mod, void* dummy )
// Stage calls this when the model starts up. we just add a callback to
// the model that gets called just after the sensor update is done.
-extern "C" int Init( StgModel* mod )
+extern "C" int Init( Model* mod )
{
mod->AddUpdateCallback( (stg_model_callback_t)LaserUpdate, NULL );
return 0; // ok
View
@@ -3,22 +3,22 @@ using namespace Stg;
const int INTERVAL = 50;
-int Update( StgModel* mod, void* dummy );
+int Update( Model* mod, void* dummy );
// Stage calls this when the model starts up
-extern "C" int Init( StgModel* mod )
+extern "C" int Init( Model* mod )
{
for( int i=0; i<5; i++ )
- mod->PushFlag( new StgFlag( stg_color_pack( 1,1,0,0), 0.5 ) );
+ mod->PushFlag( new Flag( stg_color_pack( 1,1,0,0), 0.5 ) );
mod->AddUpdateCallback( (stg_model_callback_t)Update, NULL );
return 0; //ok
}
// inspect the laser data and decide what to do
-int Update( StgModel* mod, void* dummy )
+int Update( Model* mod, void* dummy )
{
// protect access to this model from other controllers
mod->Lock();
View
@@ -3,29 +3,29 @@ using namespace Stg;
const int INTERVAL = 50;
-int Update( StgModel* mod, void* dummy );
+int Update( Model* mod, void* dummy );
const double flagsz = 0.4;
// Stage calls this when the model starts up
-extern "C" int Init( StgModel* mod )
+extern "C" int Init( Model* mod )
{
for( int i=0; i<5; i++ )
- mod->PushFlag( new StgFlag( stg_color_pack( 1,1,0,0 ), flagsz ) );
+ mod->PushFlag( new Flag( stg_color_pack( 1,1,0,0 ), flagsz ) );
mod->AddUpdateCallback( (stg_model_callback_t)Update, NULL );
return 0; //ok
}
// inspect the laser data and decide what to do
-int Update( StgModel* mod, void* dummy )
+int Update( Model* mod, void* dummy )
{
// protect access to this model from other controllers
mod->Lock();
if( mod->GetWorld()->GetUpdateCount() % INTERVAL == 0 )
- mod->PushFlag( new StgFlag( stg_color_pack( 1,1,0,0), flagsz ) );
+ mod->PushFlag( new Flag( stg_color_pack( 1,1,0,0), flagsz ) );
mod->Unlock();
View
@@ -11,24 +11,24 @@ const int avoidduration = 10;
typedef struct
{
- StgModelPosition* pos;
- StgModelLaser* laser;
+ ModelPosition* pos;
+ ModelLaser* laser;
int avoidcount, randcount;
} robot_t;
-int LaserUpdate( StgModel* mod, robot_t* robot );
-int PositionUpdate( StgModel* mod, robot_t* robot );
+int LaserUpdate( Model* mod, robot_t* robot );
+int PositionUpdate( Model* mod, robot_t* robot );
// Stage calls this when the model starts up
-extern "C" int Init( StgModel* mod )
+extern "C" int Init( Model* mod )
{
robot_t* robot = new robot_t;
robot->avoidcount = 0;
robot->randcount = 0;
- robot->pos = (StgModelPosition*)mod;
- robot->laser = (StgModelLaser*)mod->GetModel( "laser:0" );
+ robot->pos = (ModelPosition*)mod;
+ robot->laser = (ModelLaser*)mod->GetModel( "laser:0" );
robot->laser->AddUpdateCallback( (stg_model_callback_t)LaserUpdate, robot );
robot->laser->Subscribe(); // starts the laser
@@ -37,7 +37,7 @@ extern "C" int Init( StgModel* mod )
// inspect the laser data and decide what to do
-int LaserUpdate( StgModel* mod, robot_t* robot )
+int LaserUpdate( Model* mod, robot_t* robot )
{
// get the data
uint32_t sample_count=0;
@@ -123,9 +123,9 @@ int LaserUpdate( StgModel* mod, robot_t* robot )
return 0;
}
-int PositionUpdate( StgModel* mod, robot_t* robot )
+int PositionUpdate( Model* mod, robot_t* robot )
{
- stg_pose_t pose = robot->pos->GetPose();
+ Pose pose = robot->pos->GetPose();
printf( "Pose: [%.2f %.2f %.2f %.2f]\n",
pose.x, pose.y, pose.z, pose.a );
View
@@ -21,11 +21,11 @@ double turnrate = M_PI/3.0;
typedef struct
{
- StgModelLaser* laser;
- StgModelPosition* position;
- StgModelRanger* ranger;
- StgModelFiducial* fiducial;
- StgModelBlobfinder* blobfinder;
+ ModelLaser* laser;
+ ModelPosition* position;
+ ModelRanger* ranger;
+ ModelFiducial* fiducial;
+ ModelBlobfinder* blobfinder;
} robot_t;
#define VSPEED 0.4 // meters per second
@@ -59,26 +59,26 @@ int main( int argc, char* argv[] )
{
char* base = "r";
sprintf( namebuf, "%s%d", base, i );
- robots[i].position = (StgModelPosition*)world.GetModel( namebuf );
+ robots[i].position = (ModelPosition*)world.GetModel( namebuf );
assert(robots[i].position);
robots[i].position->Subscribe();
-// robots[i].laser = (StgModelLaser*)
+// robots[i].laser = (ModelLaser*)
// robots[i].position->GetUnsubscribedModelOfType( "laser" );
// assert(robots[i].laser);
// robots[i].laser->Subscribe();
-// robots[i].fiducial = (StgModelFiducial*)
+// robots[i].fiducial = (ModelFiducial*)
// robots[i].position->GetUnsubscribedModelOfType( "fiducial" );
// assert(robots[i].fiducial);
// robots[i].fiducial->Subscribe();
- robots[i].ranger = (StgModelRanger*)
+ robots[i].ranger = (ModelRanger*)
robots[i].position->GetUnsubscribedModelOfType( "ranger" );
assert(robots[i].ranger);
robots[i].ranger->Subscribe();
-// robots[i].blobfinder = (StgModelBlobfinder*)
+// robots[i].blobfinder = (ModelBlobfinder*)
// robots[i].position->GetUnsubscribedModelOfType( "blobfinder" );
// assert(robots[i].blobfinder);
// robots[i].blobfinder->Subscribe();
@@ -96,7 +96,7 @@ int main( int argc, char* argv[] )
//continue;
- StgModelRanger* rgr = robots[i].ranger;
+ ModelRanger* rgr = robots[i].ranger;
if( rgr->samples == NULL )
continue;
View
@@ -1,6 +1,6 @@
#include "stage_internal.hh"
-StgAncestor::StgAncestor()
+Ancestor::Ancestor()
{
token = NULL;
children = NULL;
@@ -11,19 +11,19 @@ StgAncestor::StgAncestor()
debug = false;
}
-StgAncestor::~StgAncestor()
+Ancestor::~Ancestor()
{
if( children )
{
for( GList* it = children; it; it=it->next )
- delete (StgModel*)it->data;
+ delete (Model*)it->data;
g_list_free( children );
}
}
-void StgAncestor::AddChild( StgModel* mod )
+void Ancestor::AddChild( Model* mod )
{
// poke a name into the child
@@ -50,23 +50,23 @@ void StgAncestor::AddChild( StgModel* mod )
delete[] buf;
}
-void StgAncestor::RemoveChild( StgModel* mod )
+void Ancestor::RemoveChild( Model* mod )
{
child_type_counts[mod->type]--;
children = g_list_remove( children, mod );
}
-stg_pose_t StgAncestor::GetGlobalPose()
+Pose Ancestor::GetGlobalPose()
{
- stg_pose_t pose;
+ Pose pose;
bzero( &pose, sizeof(pose));
return pose;
}
-void StgAncestor::ForEachDescendant( stg_model_callback_t func, void* arg )
+void Ancestor::ForEachDescendant( stg_model_callback_t func, void* arg )
{
for( GList* it=children; it; it=it->next ) {
- StgModel* mod = (StgModel*)it->data;
+ Model* mod = (Model*)it->data;
func( mod, arg );
mod->ForEachDescendant( func, arg );
}
Oops, something went wrong.

0 comments on commit 3680786

Please sign in to comment.