Revision: 7649
http://playerstage.svn.sourceforge.net/playerstage/?rev=7649&view=rev
Author: rtv
Date: 2009-05-13 22:13:42 +0000 (Wed, 13 May 2009)
Log Message:
-----------
removed grippers from FASR demo
Modified Paths:
--------------
code/stage/trunk/examples/ctrl/fasr.cc
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/stage.hh
code/stage/trunk/libstage/world.cc
code/stage/trunk/webstage/webstage.cc
code/stage/trunk/worlds/fasr.world
Modified: code/stage/trunk/examples/ctrl/fasr.cc
===================================================================
--- code/stage/trunk/examples/ctrl/fasr.cc 2009-05-13 20:20:05 UTC (rev
7648)
+++ code/stage/trunk/examples/ctrl/fasr.cc 2009-05-13 22:13:42 UTC (rev
7649)
@@ -50,7 +50,7 @@
ModelRanger* ranger;
ModelFiducial* fiducial;
ModelBlobfinder* blobfinder;
- ModelGripper* gripper;
+ //ModelGripper* gripper;
Model *source, *sink;
int avoidcount, randcount;
int work_get, work_put;
@@ -70,7 +70,7 @@
ranger( (ModelRanger*)pos->GetUnusedModelOfType(
MODEL_TYPE_RANGER )),
fiducial( (ModelFiducial*)pos->GetUnusedModelOfType(
MODEL_TYPE_FIDUCIAL )),
blobfinder( (ModelBlobfinder*)pos->GetUnusedModelOfType(
MODEL_TYPE_BLOBFINDER )),
- gripper( (ModelGripper*)pos->GetUnusedModelOfType(
MODEL_TYPE_GRIPPER )),
+ //gripper( (ModelGripper*)pos->GetUnusedModelOfType(
MODEL_TYPE_GRIPPER )),
source(source),
sink(sink),
avoidcount(0),
@@ -104,7 +104,7 @@
fiducial->Subscribe();
//gripper->AddUpdateCallback( (stg_model_callback_t)GripperUpdate,
this );
- gripper->Subscribe();
+ //gripper->Subscribe();
if( blobfinder ) // optional
{
@@ -119,12 +119,12 @@
void Dock()
{
// close the grippers so they can be pushed into the charger
- ModelGripper::config_t gripper_data = gripper->GetConfig();
+ //ModelGripper::config_t gripper_data = gripper->GetConfig();
- if( gripper_data.paddles != ModelGripper::PADDLE_CLOSED )
- gripper->CommandClose();
- else if( gripper_data.lift != ModelGripper::LIFT_UP )
- gripper->CommandUp();
+// if( gripper_data.paddles != ModelGripper::PADDLE_CLOSED )
+// gripper->CommandClose();
+// else if( gripper_data.lift != ModelGripper::LIFT_UP )
+// gripper->CommandUp();
if( charger_ahoy )
{
@@ -176,7 +176,7 @@
void UnDock()
{
- const stg_meters_t gripper_distance = 0.2;
+ //const stg_meters_t gripper_distance = 0.2;
const stg_meters_t back_off_distance = 0.3;
const stg_meters_t back_off_speed = -0.05;
@@ -187,18 +187,18 @@
pos->SetXSpeed( 0.0 );
// once we have backed off a bit, open and lower the gripper
- ModelGripper::config_t gripper_data = gripper->GetConfig();
- if( charger_range > gripper_distance )
- {
- if( gripper_data.paddles != ModelGripper::PADDLE_OPEN )
- gripper->CommandOpen();
- else if( gripper_data.lift != ModelGripper::LIFT_DOWN )
- gripper->CommandDown();
- }
+// ModelGripper::config_t gripper_data = gripper->GetConfig();
+// if( charger_range > gripper_distance )
+// {
+// if( gripper_data.paddles != ModelGripper::PADDLE_OPEN )
+// gripper->CommandOpen();
+// else if( gripper_data.lift != ModelGripper::LIFT_DOWN )
+// gripper->CommandDown();
+// }
// if the gripper is down and open and we're away from the charger,
undock is finished
- if( gripper_data.paddles == ModelGripper::PADDLE_OPEN &&
- gripper_data.lift == ModelGripper::LIFT_DOWN &&
+ if( //gripper_data.paddles == ModelGripper::PADDLE_OPEN &&
+ //gripper_data.lift == ModelGripper::LIFT_DOWN &&
charger_range > back_off_distance )
mode = MODE_WORK;
}
@@ -288,7 +288,7 @@
{
if( verbose ) puts( "Cruise" );
- ModelGripper::config_t gdata = gripper->GetConfig();
+ //ModelGripper::config_t gdata = gripper->GetConfig();
//avoidcount = 0;
pos->SetXSpeed( cruisespeed );
@@ -307,7 +307,7 @@
if( y < 0 ) y = 0;
double a_goal =
- dtor( ( pos->GetFlagCount() || gdata.gripped ) ?
have[y][x] : need[y][x] );
+ dtor( ( pos->GetFlagCount() ) ? have[y][x] :
need[y][x] );
// if we are low on juice - find the direction to the
recharger instead
if( Hungry() )
@@ -324,8 +324,8 @@
{
if( ! at_dest )
{
- if( gdata.beam[0] ) // inner break
beam broken
- gripper->CommandClose();
+ //if( gdata.beam[0] ) // inner break
beam broken
+ //gripper->CommandClose();
}
}
@@ -412,7 +412,7 @@
{
robot->at_dest = true;
- robot->gripper->CommandOpen();
+ //robot->gripper->CommandOpen();
if( ++robot->work_put > workduration )
{
@@ -469,21 +469,21 @@
return 0;
}
- static int GripperUpdate( ModelGripper* grip, Robot* robot )
- {
- ModelGripper::config_t gdata = grip->GetConfig();
+// static int GripperUpdate( ModelGripper* grip, Robot* robot )
+// {
+// ModelGripper::config_t gdata = grip->GetConfig();
- printf( "BREAKBEAMS %s %s\n",
- gdata.beam[0] ? gdata.beam[0]->Token() :
"<null>",
- gdata.beam[1] ? gdata.beam[1]->Token() :
"<null>" );
+// printf( "BREAKBEAMS %s %s\n",
+// gdata.beam[0] ? gdata.beam[0]->Token() :
"<null>",
+// gdata.beam[1] ? gdata.beam[1]->Token() :
"<null>" );
- printf( "CONTACTS %s %s\n",
- gdata.contact[0] ? gdata.contact[0]->Token() :
"<null>",
- gdata.contact[1] ? gdata.contact[1]->Token() :
"<null>");
+// printf( "CONTACTS %s %s\n",
+// gdata.contact[0] ? gdata.contact[0]->Token() :
"<null>",
+// gdata.contact[1] ? gdata.contact[1]->Token() :
"<null>");
- return 0;
- }
+// return 0;
+// }
static int FlagIncr( Model* mod, Robot* robot )
{
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2009-05-13 20:20:05 UTC (rev 7648)
+++ code/stage/trunk/libstage/model.cc 2009-05-13 22:13:42 UTC (rev 7649)
@@ -235,7 +235,7 @@
wf(NULL),
wf_entity(0),
world(world),
- world_gui( dynamic_cast< WorldGui* >( world ) )
+ world_gui( dynamic_cast<WorldGui*>( world ) )
{
assert( modelsbyid );
assert( world );
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2009-05-13 20:20:05 UTC (rev 7648)
+++ code/stage/trunk/libstage/stage.hh 2009-05-13 22:13:42 UTC (rev 7649)
@@ -1204,10 +1204,10 @@
void Rasterize( uint8_t* data,
unsigned int width, unsigned
int height,
stg_meters_t cellwidth,
stg_meters_t cellheight );
-
+
private:
Model* mod; ///< model to which this block belongs
-
+
stg_point_t* mpts; ///< cache of this->pts in model coordindates
size_t pt_count; ///< the number of points
stg_point_t* pts; ///< points defining a polygon
@@ -1583,9 +1583,8 @@
virtual void Visualize( Model* mod, Camera* cam );
void Accumulate( stg_meters_t x, stg_meters_t y, stg_joules_t
amount );
- };
-
- DissipationVis event_vis;
+ } event_vis;
+
StripPlotVis output_vis;
StripPlotVis stored_vis;
@@ -1721,30 +1720,6 @@
std::vector<Option*> drawOptions;
const std::vector<Option*>& getOptions() const { return drawOptions; }
- class RasterVis : public Visualizer
- {
- private:
- uint8_t* data;
- unsigned int width, height;
- stg_meters_t cellwidth, cellheight;
- GList* pts;
-
- public:
- RasterVis();
- virtual ~RasterVis( void ){}
- virtual void Visualize( Model* mod, Camera* cam );
-
- void SetData( uint8_t* data,
- unsigned int width,
- unsigned int height,
- stg_meters_t cellwidth,
- stg_meters_t cellheight );
-
- void AddPoint( stg_meters_t x, stg_meters_t y );
- void ClearPts();
-
- };
-
protected:
GMutex* access_mutex;
GPtrArray* blinkenlights;
@@ -1815,8 +1790,30 @@
GData* props;
/** Visualize the most recent rasterization operation performed by
this model */
- RasterVis rastervis;
+ class RasterVis : public Visualizer
+ {
+ private:
+ uint8_t* data;
+ unsigned int width, height;
+ stg_meters_t cellwidth, cellheight;
+ GList* pts;
+ public:
+ RasterVis();
+ virtual ~RasterVis( void ){}
+ virtual void Visualize( Model* mod, Camera* cam );
+
+ void SetData( uint8_t* data,
+ unsigned int width,
+ unsigned int height,
+ stg_meters_t cellwidth,
+ stg_meters_t cellheight );
+
+ void AddPoint( stg_meters_t x, stg_meters_t y );
+ void ClearPts();
+
+ } rastervis;
+
bool rebuild_displaylist; ///< iff true, regenerate block display list
before redraw
char* say_string; ///< if non-null, this string is displayed in the
GUI
@@ -2009,6 +2006,7 @@
void LoadDataBaseEntries( Worldfile* wf, int entity );
public:
+
virtual void PushColor( stg_color_t col )
{ world->PushColor( col ); }
@@ -2466,12 +2464,9 @@
Vis( World* world );
virtual ~Vis( void ){}
virtual void Visualize( Model* mod, Camera* cam );
- };
+ } vis;
- Vis vis;
- //class LaserRay : public Ray
-
/** OpenGL displaylist for laser data */
int data_dl;
bool data_dirty;
Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc 2009-05-13 20:20:05 UTC (rev 7648)
+++ code/stage/trunk/libstage/world.cc 2009-05-13 22:13:42 UTC (rev 7649)
@@ -258,12 +258,6 @@
//g_hash_table_insert( blockgroups_by_entity, (gpointer)entity,
mod->blockgroup );
}
-// delete a model from the hash table
-static void destroy_sregion( gpointer dummy1, SuperRegion* sr, gpointer dummy2
)
-{
- free(sr);
-}
-
void World::Load( const char* worldfile_path )
{
// note: must call Unload() before calling Load() if a world already
Modified: code/stage/trunk/webstage/webstage.cc
===================================================================
--- code/stage/trunk/webstage/webstage.cc 2009-05-13 20:20:05 UTC (rev
7648)
+++ code/stage/trunk/webstage/webstage.cc 2009-05-13 22:13:42 UTC (rev
7649)
@@ -55,7 +55,41 @@
printf( "Warning: attempt to push PVA for unrecognized model
\"%s\"\n",
name.c_str() );
}
+
+ void Push()
+ {
+ for( std::map<std::string,Puppet*>::iterator it = puppets.begin();
+ it != puppets.end();
+ it++ )
+ {
+ Puppet* pup = it->second;
+ assert(pup);
+
+ Stg::Model* mod = world->GetModel( pup->name.c_str() );
+ assert(mod);
+
+ websim::Pose p;
+ websim::Velocity v;
+ websim::Acceleration a;
+
+ Stg::Pose sp = mod->GetPose();
+ p.x = sp.x;
+ p.y = sp.y;
+ p.z = sp.z;
+ p.a = sp.a;
+
+ Stg::Velocity sv = mod->GetVelocity();
+ v.x = sv.x;
+ v.y = sv.y;
+ v.z = sv.z;
+ v.a = sv.a;
+
+ pup->Push( p,v,a );
+ printf( "pushing puppet %s\n", pup->name.c_str() );
+ }
+ }
+
// Interface to be implemented by simulators
virtual bool CreateModel(const std::string& name,
const
std::string& type,
@@ -146,11 +180,12 @@
return t;
}
- static void UpdatePuppetCb( const std::string& name, WebSim::Puppet* pup,
void* arg )
- {
- WebStage* ws = (WebStage*)arg;
- ws->Push( pup->name );
- }
+// static void UpdatePuppetCb( const std::string& name, WebSim::Puppet* pup,
void* arg )
+// {
+// WebStage* ws = (WebStage*)arg;
+// ws->Push( pup->name );
+// }
+
};
@@ -224,9 +259,8 @@
while( ! quit )
{
// todo? check for changes?
- // send my updates
-
- ws.ForEachPuppet( WebStage::UpdatePuppetCb, (void*)&ws );
+ // send my updates
+ ws.Push();
//puts( "pushes done" );
// tell my friends to start simulating
Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world 2009-05-13 20:20:05 UTC (rev 7648)
+++ code/stage/trunk/worlds/fasr.world 2009-05-13 22:13:42 UTC (rev 7649)
@@ -142,15 +142,16 @@
joules 100000
joules_capacity 400000
fiducial_return 0
- # charging_bump( fiducial( range 3 pose [ 0 0 -0.100 0 ] ) )
+ charging_bump( fiducial( range 3 pose [ 0 0 -0.100 0 ] ) )
- gripper( pose [0.250 0 -0.220 0]
- take_watts 1000.0
- fiducial( range 3 )
- # paddles [ "closed" "up" ]
- obstacle_return 0 # cheating for simplicity
- # autosnatch 1
- )
+
+ #gripper( pose [0.250 0 -0.220 0]
+ # take_watts 1000.0
+ # fiducial( range 3 )
+ # # paddles [ "closed" "up" ]
+# obstacle_return 0 # cheating for simplicity
+# # autosnatch 1
+# )
)
autorob( pose [5.488 5.149 0 35.947] joules 300000 name "r0" )
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit