Update of /cvsroot/playerstage/code/stage/examples/ctrl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4662/examples/ctrl

Modified Files:
        fasr.cc sink.cc source.cc 
Log Message:
resource transport demo

Index: sink.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/examples/ctrl/sink.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** sink.cc     3 Mar 2008 06:02:25 -0000       1.1
--- sink.cc     3 Mar 2008 07:01:12 -0000       1.2
***************
*** 2,6 ****
  using namespace Stg;
  
! const int INTERVAL = 100;
  
  int Update( StgModel* mod, void* dummy );
--- 2,6 ----
  using namespace Stg;
  
! const int INTERVAL = 50;
  
  int Update( StgModel* mod, void* dummy );

Index: fasr.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/examples/ctrl/fasr.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** fasr.cc     3 Mar 2008 06:02:25 -0000       1.1
--- fasr.cc     3 Mar 2008 07:01:12 -0000       1.2
***************
*** 9,12 ****
--- 9,15 ----
  const bool verbose = false;
  const int avoidduration = 10;
+ const int workduration = 20;
+ const int payload = 4;
+ 
  
  double have[4][4] = { 
***************
*** 14,23 ****
    { 90, -90, 0, -90 },
    { 90, 90, 180, 90 },
!   { 0, 0, 0, 45} 
  };
  
  double need[4][4] = {
    { -120, -180, 180, 180 },
!   { -90, -90, 180, 180 },
    { -90, -90, 180, 180 },
    { -90, -180, -90, -90 }
--- 17,26 ----
    { 90, -90, 0, -90 },
    { 90, 90, 180, 90 },
!   { 0, 45, 0, 45} 
  };
  
  double need[4][4] = {
    { -120, -180, 180, 180 },
!   { -90, -120, 180, 180 },
    { -90, -90, 180, 180 },
    { -90, -180, -90, -90 }
***************
*** 36,40 ****
    int avoidcount, randcount;
  
!   int latch;
  
  } robot_t;
--- 39,43 ----
    int avoidcount, randcount;
  
!   int work_get, work_put;
  
  } robot_t;
***************
*** 47,51 ****
  {
    robot_t* robot = new robot_t;
!   robot->latch = 0;
    
    //robot->flag = new StgFlag( stg_color_pack( 1,1,0,0.5 ), 3 );
--- 50,55 ----
  {
    robot_t* robot = new robot_t;
!   robot->work_get = 0;
!   robot->work_put = 0;
    
    //robot->flag = new StgFlag( stg_color_pack( 1,1,0,0.5 ), 3 );
***************
*** 151,176 ****
    stg_pose_t pose = robot->pos->GetPose();
    
!   if( --robot->latch < 1 )
      {
!       //printf( "Pose: [%.2f %.2f %.2f %.2f]\n",
!       //  pose.x, pose.y, pose.z, pose.a );
!       
!       if( hypot( -7-pose.x, -7-pose.y ) < 2.0 )
        {
-         //puts( "collecting" );
          robot->pos->PushFlag( robot->source->PopFlag() );
!       }
!       
!       if( hypot( 7-pose.x, 7-pose.y ) < 1.0 )
        {
          //puts( "dropping" );
          // transfer a chunk between robot and goal
          robot->sink->PushFlag( robot->pos->PopFlag() );
        }
- 
-       robot->latch = 20;
      }
! 
! 
    return 0; // run again
  }
--- 155,182 ----
    stg_pose_t pose = robot->pos->GetPose();
    
!   //printf( "Pose: [%.2f %.2f %.2f %.2f]\n",
!   //  pose.x, pose.y, pose.z, pose.a );
!   
!   if( robot->pos->GetFlagCount() < payload && 
!       hypot( -7-pose.x, -7-pose.y ) < 2.0 )
      {
!       if( ++robot->work_get > workduration )
        {
          robot->pos->PushFlag( robot->source->PopFlag() );
!         robot->work_get = 0;
!       }         
!     }
!   
!   if( hypot( 7-pose.x, 7-pose.y ) < 1.0 )
!     {
!       if( ++robot->work_put > workduration )
        {
          //puts( "dropping" );
          // transfer a chunk between robot and goal
          robot->sink->PushFlag( robot->pos->PopFlag() );
+         robot->work_put = 0;
        }
      }
!   
    return 0; // run again
  }

Index: source.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/examples/ctrl/source.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** source.cc   3 Mar 2008 06:02:25 -0000       1.1
--- source.cc   3 Mar 2008 07:01:12 -0000       1.2
***************
*** 2,6 ****
  using namespace Stg;
  
! const int INTERVAL = 100;
  
  int Update( StgModel* mod, void* dummy );
--- 2,6 ----
  using namespace Stg;
  
! const int INTERVAL = 50;
  
  int Update( StgModel* mod, void* dummy );


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to