/home/fwph/code/wurde/rde/core/capabilities/ObstacleAvoiderTransport.cpp

Go to the documentation of this file.
00001 
00029 #include <ObstacleAvoiderTransport.H>
00030 #include <CommsManager.H>
00031 #include <Logger.H>
00032 
00033 // $Id: Type.cpp 68 2007-02-01 17:56:57Z fwph $
00034 
00035 using namespace WURDE;
00036 
00037 ObstacleAvoiderTransport::ObstacleAvoiderTransport(const std::string & streamname){
00038        init(streamname,STRAT_NORMAL,"Any");
00039 
00040        //global name will be set later
00041        m_haveGlobalname=false;
00042 }
00043 
00044 ObstacleAvoiderTransport::ObstacleAvoiderTransport(const ConnectionStrategy & strategy,const std::string & gblName){
00045        init("Any",strategy,gblName);
00046 
00047        if(strategy==STRAT_NORMAL){
00048               //then the global name really specifies the streamname,
00049               // and the global name should be assigned automagically once we have
00050               // confirmation that the stream has been started
00051               m_haveGlobalname=false;   
00052        }
00053 
00054        m_haveStream=false;
00055        
00056 }
00057 
00058 ObstacleAvoiderTransport::ObstacleAvoiderTransport(const std::string &streamname,const std::string &gblName){
00059        init(streamname,STRAT_NORMAL,gblName);
00060 }
00061 
00062 void ObstacleAvoiderTransport::init(const std::string &streamname,const ConnectionStrategy &strategy,const std::string &gblName){
00063   m_globalname=gblName;
00064   m_streamname=streamname;
00065 
00066   myCOMObject=NULL;
00067   
00068   //  data.source=streamname.c_str();
00069   requests=info;
00070 
00071   m_queue=false;
00072   m_supplier=false;
00073   m_doTimestamp=true;
00074   m_doTag=true;
00075 
00076   m_doPublishData=false;
00077   m_doPublishInfo=false;
00078 
00079   m_initialize=false;
00080   m_strategy=strategy;
00081 
00082   m_haveStream=true;
00083   m_haveGlobalname=true;
00084   m_doPublishData=false;
00085   m_doPublishInfo=false;
00086 
00087   m_doAutoPing=true;
00088 
00089   info.source=streamname;
00090   requests.source=m_globalname;
00091   info.target="Any";
00092   requests.target=streamname;
00093   info.timestamp.now();
00094   requests.timestamp.now();
00095 
00096   m_streamRequest=STAT_NULL;
00097   
00098   m_sourceModule="Unknown";
00099 }
00100 
00101 
00102 ObstacleAvoiderTransport::~ObstacleAvoiderTransport(){
00103   myManager=NULL;
00104   if(myCOMObject){
00105 
00106          //      delete myCOMObject;
00107   }
00108 }
00109 
00110 
00111 void ObstacleAvoiderTransport::activateSupplier(){
00112        if(m_haveStream){
00113               m_supplier=true;
00114               m_globalname=m_streamname;
00115               m_haveGlobalname=true;
00116               m_initialize=false;
00117               if(myCOMObject){
00118                       //                     myCOMObject=new CMUIPCRobotProtocol::CMUIPCObstacleAvoiderTransport(m_globalname);
00119                      myCOMObject->setGlobalName(m_globalname);
00120                      myCOMObject->setStreamName(m_streamname);
00121                      myCOMObject->setInfo(&requests);
00122                      myCOMObject->setRequests(&info);
00123                      myCOMObject->setStaging(&data);
00124                      myCOMObject->activateSupplier();
00125                      myCOMObject->setAutoPing(m_doAutoPing);
00126                      myCOMObject->setInfoVector(&m_requestVector);
00127                      myCOMObject->setRequestVector(&m_infoVector);
00128                      myCOMObject->setDataVector(&m_dataVector);
00129 
00130                      data.source=m_streamname;
00131                      info.source=m_streamname;
00132 
00133                      if(m_queue){
00134                             myCOMObject->setQueueMode(true);
00135                      }
00136 
00137               }else{
00138                       g_fatal("Attempted to activateSupplier before setting a COMObject Please just use registerSupplier.");
00139                       exit(-1);
00140               }
00141         data.pathObstructed=0;
00142         data.distanceToGoal=0;
00143         data.angleToGoal=0;
00144         if(m_supplier){
00145                 info.absolute.setCMode(C_SUPPLIER);
00146         }else{
00147                 info.absolute.setCMode(C_CONSUMER);
00148         }
00149         if(m_supplier){
00150                 info.avoidanceRadius.setCMode(C_SUPPLIER);
00151         }else{
00152                 info.avoidanceRadius.setCMode(C_CONSUMER);
00153         }
00154         if(m_supplier){
00155                 info.maxTranslationVelocity.setCMode(C_SUPPLIER);
00156         }else{
00157                 info.maxTranslationVelocity.setCMode(C_CONSUMER);
00158         }
00159         if(m_supplier){
00160                 info.goalHasLocation.setCMode(C_SUPPLIER);
00161         }else{
00162                 info.goalHasLocation.setCMode(C_CONSUMER);
00163         }
00164         if(m_supplier){
00165                 info.goalHasTheta.setCMode(C_SUPPLIER);
00166         }else{
00167                 info.goalHasTheta.setCMode(C_CONSUMER);
00168         }
00169         if(m_supplier){
00170                 info.brake.setCMode(C_SUPPLIER);
00171         }else{
00172                 info.brake.setCMode(C_CONSUMER);
00173         }
00174         if(m_supplier){
00175                 info.maxRotationVelocity.setCMode(C_SUPPLIER);
00176         }else{
00177                 info.maxRotationVelocity.setCMode(C_CONSUMER);
00178         }
00179         if(m_supplier){
00180                 info.goalPose.setCMode(C_SUPPLIER);
00181         }else{
00182                 info.goalPose.setCMode(C_CONSUMER);
00183         }
00184        }else{
00185               //this shouldn't happen, but there's no real problem with it.
00186               //it'd just be dumb.
00187               m_initialize=true;
00188               m_supplier=true;
00189        }
00190        
00191        requests=info;
00192 
00193 }
00194 
00195 void ObstacleAvoiderTransport::activateConsumer(){
00196        std::string localname;
00197        
00198        if(m_haveStream){
00199               m_initialize=false;
00200               m_supplier=false;
00201               if(myCOMObject&&myManager){
00202                       /* global name so we don't have conflicts with the naming service */
00203                       if(!m_haveGlobalname&&m_strategy==STRAT_NORMAL){
00204                               m_globalname=myManager->getName()+OBSTACLEAVOIDERTRANSPORT+m_streamname+"Consumer";
00205                               m_haveGlobalname=true;
00206                       }
00207 
00208                      myCOMObject->setGlobalName(m_globalname);
00209                      myCOMObject->setStreamName(m_streamname);
00210                      requests.source=m_globalname;
00211                      data.source=m_streamname;
00212                      info.source=m_streamname;
00213                      myCOMObject->setInfo(&info);
00214                      myCOMObject->setRequests(&requests);
00215                      myCOMObject->setStaging(&data);
00216                      myCOMObject->setAutoPing(m_doAutoPing);
00217                      myCOMObject->activateConsumer();
00218                      myCOMObject->setInfoVector(&m_infoVector);
00219                      myCOMObject->setRequestVector(&m_requestVector);
00220                      myCOMObject->setDataVector(&m_dataVector);
00221 
00222                      if(m_queue){
00223                             myCOMObject->setQueueMode(true);
00224                      }
00225               }else{
00226                       g_fatal("Attempted to activateConsumer before setting a COMObject and CommsManager. Please use registerConsumer instead.");
00227                      exit(-1);
00228               }
00229 
00230         data.pathObstructed=0;
00231         data.distanceToGoal=0;
00232         data.angleToGoal=0;
00233         if(m_supplier){
00234                 info.absolute.setCMode(C_SUPPLIER);
00235         }else{
00236                 info.absolute.setCMode(C_CONSUMER);
00237         }
00238         if(m_supplier){
00239                 info.avoidanceRadius.setCMode(C_SUPPLIER);
00240         }else{
00241                 info.avoidanceRadius.setCMode(C_CONSUMER);
00242         }
00243         if(m_supplier){
00244                 info.maxTranslationVelocity.setCMode(C_SUPPLIER);
00245         }else{
00246                 info.maxTranslationVelocity.setCMode(C_CONSUMER);
00247         }
00248         if(m_supplier){
00249                 info.goalHasLocation.setCMode(C_SUPPLIER);
00250         }else{
00251                 info.goalHasLocation.setCMode(C_CONSUMER);
00252         }
00253         if(m_supplier){
00254                 info.goalHasTheta.setCMode(C_SUPPLIER);
00255         }else{
00256                 info.goalHasTheta.setCMode(C_CONSUMER);
00257         }
00258         if(m_supplier){
00259                 info.brake.setCMode(C_SUPPLIER);
00260         }else{
00261                 info.brake.setCMode(C_CONSUMER);
00262         }
00263         if(m_supplier){
00264                 info.maxRotationVelocity.setCMode(C_SUPPLIER);
00265         }else{
00266                 info.maxRotationVelocity.setCMode(C_CONSUMER);
00267         }
00268         if(m_supplier){
00269                 info.goalPose.setCMode(C_SUPPLIER);
00270         }else{
00271                 info.goalPose.setCMode(C_CONSUMER);
00272         }
00273        }else{
00274               //no stream, so we can't connect yet. tell the system 
00275               //to initialize as soon as we've got one
00276               m_initialize=true;
00277        }
00278 
00279 }
00280 
00281 void ObstacleAvoiderTransport::runUpdate(){
00282        if(myCOMObject){
00283 
00284               myCOMObject->runUpdate(m_doPublishData,m_doPublishInfo);
00285               
00286               m_doPublishData=false;
00287               m_doPublishInfo=false;
00288               
00289        }
00290 }
00291 
00292 void ObstacleAvoiderTransport::setManager(CommsManager *myManager_){
00293 
00294   if(!myCOMObject){
00295     myManager=myManager_;
00296   }
00297 
00298 }
00299 
00300 void ObstacleAvoiderTransport::setQueueMode(const bool & val){
00301 
00302        if(!myCOMObject){
00303               m_queue=val;
00304        }else if(!m_queue&&val){
00305               m_queue=val;
00306               myCOMObject->setDataVector(&m_dataVector);
00307               myCOMObject->setQueueMode(true);
00308 
00309        }else if(!val&&m_queue){
00310               m_queue=val;
00311               myCOMObject->setQueueMode(false);
00312               while(!m_dataVector.empty()){
00313                      m_dataVector.pop();
00314               }
00315               while(!m_infoVector.empty()){
00316                      m_infoVector.pop();
00317               }
00318               while(!m_requestVector.empty()){
00319                      m_requestVector.pop();
00320               }
00321        }
00322 }
00323 
00324 bool ObstacleAvoiderTransport::newData(){
00325        if(m_queue){
00326               return !m_dataVector.empty();
00327        }else{
00328               if(myCOMObject){
00329                      return myCOMObject->newData();
00330               }
00331        }
00332 
00333        return false;
00334 }
00335 
00336 bool ObstacleAvoiderTransport::newInfo(){
00337        if(m_queue){
00338               if(m_supplier){
00339                      return !m_requestVector.empty();
00340               }
00341 
00342               return !m_infoVector.empty();
00343        }else{
00344               if(myCOMObject){
00345                      return myCOMObject->newInfo();
00346               }
00347        }
00348 
00349 
00350        return false;
00351 }
00352 
00353 void ObstacleAvoiderTransport::publishData(){
00354        if(m_supplier){
00355               if(m_doTimestamp){
00356                      data.timestamp.now();
00357               }
00358               if(m_doTag){
00359                      data.source=m_globalname;
00360               }
00361               if(m_queue){
00362                      ObstacleAvoiderTransportDataStruct temp;
00363         temp.pathObstructed=0;
00364         temp.distanceToGoal=0;
00365         temp.angleToGoal=0;
00366                      temp.source=data.source;
00367 temp.pathObstructed=data.pathObstructed;
00368 temp.timestamp=data.timestamp;
00369 temp.distanceToGoal=data.distanceToGoal;
00370 temp.angleToGoal=data.angleToGoal;
00371  
00372                      m_dataVector.push(temp);
00373                               //                     m_dataVector.push(data);
00374               }
00375               m_doPublishData=true;
00376        }
00377 }
00378 
00379 void ObstacleAvoiderTransport::publishInfo(){
00380        if(m_supplier){
00381 
00382               info.mType=MESSAGE_INFO;
00383               if(m_doTimestamp){
00384                      info.timestamp.now();
00385               }
00386 
00387               if(m_doTag){
00388                      info.source=m_globalname;
00389                      info.target="Any";
00390               }
00391 
00392               if(m_queue){
00393                      ObstacleAvoiderTransportInfoStruct temp;
00394                      
00395                     
00396                      temp.source=info.source;
00397 temp.absolute=info.absolute;
00398 temp.avoidanceRadius=info.avoidanceRadius;
00399 temp.maxTranslationVelocity=info.maxTranslationVelocity;
00400 temp.goalHasLocation=info.goalHasLocation;
00401 temp.mType=info.mType;
00402 temp.target=info.target;
00403 temp.timestamp=info.timestamp;
00404 temp.goalHasTheta=info.goalHasTheta;
00405 temp.brake=info.brake;
00406 temp.maxRotationVelocity=info.maxRotationVelocity;
00407 temp.goalPose=info.goalPose;
00408 
00409                      m_infoVector.push(temp);
00410                     
00411                      //              m_infoVector.push(info);
00412               }
00413 
00414               m_doPublishInfo=true;
00415        }else{
00416 
00417               requests.mType=MESSAGE_REQUEST;
00418               
00419               if(m_doTimestamp){
00420                      requests.timestamp.now();
00421               }
00422 
00423               if(m_doTag){
00424                      requests.source=m_globalname;
00425                      requests.target=m_streamname;
00426               }
00427 
00428               if(m_queue){
00429                      ObstacleAvoiderTransportInfoStruct temp;
00430         if(m_supplier){
00431                 temp.absolute.setCMode(C_SUPPLIER);
00432         }else{
00433                 temp.absolute.setCMode(C_CONSUMER);
00434         }
00435         if(m_supplier){
00436                 temp.avoidanceRadius.setCMode(C_SUPPLIER);
00437         }else{
00438                 temp.avoidanceRadius.setCMode(C_CONSUMER);
00439         }
00440         if(m_supplier){
00441                 temp.maxTranslationVelocity.setCMode(C_SUPPLIER);
00442         }else{
00443                 temp.maxTranslationVelocity.setCMode(C_CONSUMER);
00444         }
00445         if(m_supplier){
00446                 temp.goalHasLocation.setCMode(C_SUPPLIER);
00447         }else{
00448                 temp.goalHasLocation.setCMode(C_CONSUMER);
00449         }
00450         if(m_supplier){
00451                 temp.goalHasTheta.setCMode(C_SUPPLIER);
00452         }else{
00453                 temp.goalHasTheta.setCMode(C_CONSUMER);
00454         }
00455         if(m_supplier){
00456                 temp.brake.setCMode(C_SUPPLIER);
00457         }else{
00458                 temp.brake.setCMode(C_CONSUMER);
00459         }
00460         if(m_supplier){
00461                 temp.maxRotationVelocity.setCMode(C_SUPPLIER);
00462         }else{
00463                 temp.maxRotationVelocity.setCMode(C_CONSUMER);
00464         }
00465         if(m_supplier){
00466                 temp.goalPose.setCMode(C_SUPPLIER);
00467         }else{
00468                 temp.goalPose.setCMode(C_CONSUMER);
00469         }
00470                      temp.source=requests.source;
00471 temp.absolute=requests.absolute;
00472 temp.avoidanceRadius=requests.avoidanceRadius;
00473 temp.maxTranslationVelocity=requests.maxTranslationVelocity;
00474 temp.goalHasLocation=requests.goalHasLocation;
00475 temp.mType=requests.mType;
00476 temp.target=requests.target;
00477 temp.timestamp=requests.timestamp;
00478 temp.goalHasTheta=requests.goalHasTheta;
00479 temp.brake=requests.brake;
00480 temp.maxRotationVelocity=requests.maxRotationVelocity;
00481 temp.goalPose=requests.goalPose;
00482 
00483                      m_requestVector.push(temp);
00484 
00485                      //              m_requestVector.push(requests);
00486               }
00487 
00488               m_doPublishInfo=true;
00489        }
00490 }
00491 
00492 ObstacleAvoiderTransportDataStruct ObstacleAvoiderTransport::getNextData(){
00493        if(m_queue){
00494               ObstacleAvoiderTransportDataStruct retval;
00495         retval.pathObstructed=0;
00496         retval.distanceToGoal=0;
00497         retval.angleToGoal=0;
00498               retval.source="NULL";
00499               if(m_dataVector.empty()){
00500                      return data;
00501               }
00502              
00503               retval.source=m_dataVector.front().source;
00504 retval.pathObstructed=m_dataVector.front().pathObstructed;
00505 retval.angleToGoal=m_dataVector.front().angleToGoal;
00506 retval.timestamp=m_dataVector.front().timestamp;
00507 retval.distanceToGoal=m_dataVector.front().distanceToGoal;
00508 
00509                        //             retval=m_dataVector.front();
00510               m_dataVector.pop();
00511               data=retval;
00512        
00513               return retval;
00514        }else{
00515               myCOMObject->resetData();
00516               return data;
00517        }
00518 }
00519 
00520 ObstacleAvoiderTransportInfoStruct ObstacleAvoiderTransport::getNextInfo(){
00521        if(m_queue){
00522               ObstacleAvoiderTransportInfoStruct retval;
00523         if(m_supplier){
00524                 retval.absolute.setCMode(C_SUPPLIER);
00525         }else{
00526                 retval.absolute.setCMode(C_CONSUMER);
00527         }
00528         if(m_supplier){
00529                 retval.avoidanceRadius.setCMode(C_SUPPLIER);
00530         }else{
00531                 retval.avoidanceRadius.setCMode(C_CONSUMER);
00532         }
00533         if(m_supplier){
00534                 retval.maxTranslationVelocity.setCMode(C_SUPPLIER);
00535         }else{
00536                 retval.maxTranslationVelocity.setCMode(C_CONSUMER);
00537         }
00538         if(m_supplier){
00539                 retval.goalHasLocation.setCMode(C_SUPPLIER);
00540         }else{
00541                 retval.goalHasLocation.setCMode(C_CONSUMER);
00542         }
00543         if(m_supplier){
00544                 retval.goalHasTheta.setCMode(C_SUPPLIER);
00545         }else{
00546                 retval.goalHasTheta.setCMode(C_CONSUMER);
00547         }
00548         if(m_supplier){
00549                 retval.brake.setCMode(C_SUPPLIER);
00550         }else{
00551                 retval.brake.setCMode(C_CONSUMER);
00552         }
00553         if(m_supplier){
00554                 retval.maxRotationVelocity.setCMode(C_SUPPLIER);
00555         }else{
00556                 retval.maxRotationVelocity.setCMode(C_CONSUMER);
00557         }
00558         if(m_supplier){
00559                 retval.goalPose.setCMode(C_SUPPLIER);
00560         }else{
00561                 retval.goalPose.setCMode(C_CONSUMER);
00562         }
00563               retval.source="NULL";
00564               if(m_supplier){
00565                      if(m_requestVector.empty()){
00566                             return requests;
00567                      }
00568                      retval.source=m_requestVector.front().source;
00569 retval.absolute=m_requestVector.front().absolute;
00570 retval.avoidanceRadius=m_requestVector.front().avoidanceRadius;
00571 retval.maxTranslationVelocity=m_requestVector.front().maxTranslationVelocity;
00572 retval.goalHasLocation=m_requestVector.front().goalHasLocation;
00573 retval.mType=m_requestVector.front().mType;
00574 retval.target=m_requestVector.front().target;
00575 retval.timestamp=m_requestVector.front().timestamp;
00576 retval.goalHasTheta=m_requestVector.front().goalHasTheta;
00577 retval.brake=m_requestVector.front().brake;
00578 retval.maxRotationVelocity=m_requestVector.front().maxRotationVelocity;
00579 retval.goalPose=m_requestVector.front().goalPose;
00580 
00581                               //                     retval=m_requestVector.front();
00582         if(m_supplier){
00583                 retval.absolute.setCMode(C_SUPPLIER);
00584         }else{
00585                 retval.absolute.setCMode(C_CONSUMER);
00586         }
00587         if(m_supplier){
00588                 retval.avoidanceRadius.setCMode(C_SUPPLIER);
00589         }else{
00590                 retval.avoidanceRadius.setCMode(C_CONSUMER);
00591         }
00592         if(m_supplier){
00593                 retval.maxTranslationVelocity.setCMode(C_SUPPLIER);
00594         }else{
00595                 retval.maxTranslationVelocity.setCMode(C_CONSUMER);
00596         }
00597         if(m_supplier){
00598                 retval.goalHasLocation.setCMode(C_SUPPLIER);
00599         }else{
00600                 retval.goalHasLocation.setCMode(C_CONSUMER);
00601         }
00602         if(m_supplier){
00603                 retval.goalHasTheta.setCMode(C_SUPPLIER);
00604         }else{
00605                 retval.goalHasTheta.setCMode(C_CONSUMER);
00606         }
00607         if(m_supplier){
00608                 retval.brake.setCMode(C_SUPPLIER);
00609         }else{
00610                 retval.brake.setCMode(C_CONSUMER);
00611         }
00612         if(m_supplier){
00613                 retval.maxRotationVelocity.setCMode(C_SUPPLIER);
00614         }else{
00615                 retval.maxRotationVelocity.setCMode(C_CONSUMER);
00616         }
00617         if(m_supplier){
00618                 retval.goalPose.setCMode(C_SUPPLIER);
00619         }else{
00620                 retval.goalPose.setCMode(C_CONSUMER);
00621         }
00622                      m_requestVector.pop();
00623                      requests=retval;
00624                      return retval;
00625               }else{
00626                      if(m_infoVector.empty()){
00627                             return info;
00628                      }
00629                      retval.source=m_infoVector.front().source;
00630 retval.absolute=m_infoVector.front().absolute;
00631 retval.avoidanceRadius=m_infoVector.front().avoidanceRadius;
00632 retval.maxTranslationVelocity=m_infoVector.front().maxTranslationVelocity;
00633 retval.goalHasLocation=m_infoVector.front().goalHasLocation;
00634 retval.mType=m_infoVector.front().mType;
00635 retval.target=m_infoVector.front().target;
00636 retval.timestamp=m_infoVector.front().timestamp;
00637 retval.goalHasTheta=m_infoVector.front().goalHasTheta;
00638 retval.brake=m_infoVector.front().brake;
00639 retval.maxRotationVelocity=m_infoVector.front().maxRotationVelocity;
00640 retval.goalPose=m_infoVector.front().goalPose;
00641 
00642         if(m_supplier){
00643                 retval.absolute.setCMode(C_SUPPLIER);
00644         }else{
00645                 retval.absolute.setCMode(C_CONSUMER);
00646         }
00647         if(m_supplier){
00648                 retval.avoidanceRadius.setCMode(C_SUPPLIER);
00649         }else{
00650                 retval.avoidanceRadius.setCMode(C_CONSUMER);
00651         }
00652         if(m_supplier){
00653                 retval.maxTranslationVelocity.setCMode(C_SUPPLIER);
00654         }else{
00655                 retval.maxTranslationVelocity.setCMode(C_CONSUMER);
00656         }
00657         if(m_supplier){
00658                 retval.goalHasLocation.setCMode(C_SUPPLIER);
00659         }else{
00660                 retval.goalHasLocation.setCMode(C_CONSUMER);
00661         }
00662         if(m_supplier){
00663                 retval.goalHasTheta.setCMode(C_SUPPLIER);
00664         }else{
00665                 retval.goalHasTheta.setCMode(C_CONSUMER);
00666         }
00667         if(m_supplier){
00668                 retval.brake.setCMode(C_SUPPLIER);
00669         }else{
00670                 retval.brake.setCMode(C_CONSUMER);
00671         }
00672         if(m_supplier){
00673                 retval.maxRotationVelocity.setCMode(C_SUPPLIER);
00674         }else{
00675                 retval.maxRotationVelocity.setCMode(C_CONSUMER);
00676         }
00677         if(m_supplier){
00678                 retval.goalPose.setCMode(C_SUPPLIER);
00679         }else{
00680                 retval.goalPose.setCMode(C_CONSUMER);
00681         }
00682                      m_infoVector.pop();
00683                      info=retval;
00684                      // the requests struct really should get the values in 
00685                      // info
00686                      requests=info;
00687                      
00688                      return retval;
00689               }
00690        }else{
00691               myCOMObject->resetInfo();
00692               if(m_supplier){
00693         if(m_supplier){
00694                 requests.absolute.setCMode(C_SUPPLIER);
00695         }else{
00696                 requests.absolute.setCMode(C_CONSUMER);
00697         }
00698         if(m_supplier){
00699                 requests.avoidanceRadius.setCMode(C_SUPPLIER);
00700         }else{
00701                 requests.avoidanceRadius.setCMode(C_CONSUMER);
00702         }
00703         if(m_supplier){
00704                 requests.maxTranslationVelocity.setCMode(C_SUPPLIER);
00705         }else{
00706                 requests.maxTranslationVelocity.setCMode(C_CONSUMER);
00707         }
00708         if(m_supplier){
00709                 requests.goalHasLocation.setCMode(C_SUPPLIER);
00710         }else{
00711                 requests.goalHasLocation.setCMode(C_CONSUMER);
00712         }
00713         if(m_supplier){
00714                 requests.goalHasTheta.setCMode(C_SUPPLIER);
00715         }else{
00716                 requests.goalHasTheta.setCMode(C_CONSUMER);
00717         }
00718         if(m_supplier){
00719                 requests.brake.setCMode(C_SUPPLIER);
00720         }else{
00721                 requests.brake.setCMode(C_CONSUMER);
00722         }
00723         if(m_supplier){
00724                 requests.maxRotationVelocity.setCMode(C_SUPPLIER);
00725         }else{
00726                 requests.maxRotationVelocity.setCMode(C_CONSUMER);
00727         }
00728         if(m_supplier){
00729                 requests.goalPose.setCMode(C_SUPPLIER);
00730         }else{
00731                 requests.goalPose.setCMode(C_CONSUMER);
00732         }
00733                      return requests;
00734               }else{
00735         if(m_supplier){
00736                 info.absolute.setCMode(C_SUPPLIER);
00737         }else{
00738                 info.absolute.setCMode(C_CONSUMER);
00739         }
00740         if(m_supplier){
00741                 info.avoidanceRadius.setCMode(C_SUPPLIER);
00742         }else{
00743                 info.avoidanceRadius.setCMode(C_CONSUMER);
00744         }
00745         if(m_supplier){
00746                 info.maxTranslationVelocity.setCMode(C_SUPPLIER);
00747         }else{
00748                 info.maxTranslationVelocity.setCMode(C_CONSUMER);
00749         }
00750         if(m_supplier){
00751                 info.goalHasLocation.setCMode(C_SUPPLIER);
00752         }else{
00753                 info.goalHasLocation.setCMode(C_CONSUMER);
00754         }
00755         if(m_supplier){
00756                 info.goalHasTheta.setCMode(C_SUPPLIER);
00757         }else{
00758                 info.goalHasTheta.setCMode(C_CONSUMER);
00759         }
00760         if(m_supplier){
00761                 info.brake.setCMode(C_SUPPLIER);
00762         }else{
00763                 info.brake.setCMode(C_CONSUMER);
00764         }
00765         if(m_supplier){
00766                 info.maxRotationVelocity.setCMode(C_SUPPLIER);
00767         }else{
00768                 info.maxRotationVelocity.setCMode(C_CONSUMER);
00769         }
00770         if(m_supplier){
00771                 info.goalPose.setCMode(C_SUPPLIER);
00772         }else{
00773                 info.goalPose.setCMode(C_CONSUMER);
00774         }
00775                      // the requests struct really should get the values in 
00776                      // info
00777                      requests=info;
00778                      return info;
00779               }
00780        }
00781 }
00782 
00783 void ObstacleAvoiderTransport::setStreamName(const std::string & name){
00784 
00785        if(m_supplier&&name=="Any"){
00786               return;
00787        }
00788 
00789        m_streamname=name;
00790        m_haveStream=true;
00791 
00792        if(m_supplier){
00793               m_globalname=name;
00794        }
00795        
00796        if(myCOMObject){
00797               myCOMObject->setStreamName(name);
00798        }
00799 
00800        if(m_initialize){
00801               if(m_supplier){
00802                      activateSupplier();
00803               }else{
00804                      activateConsumer();
00805               }
00806        }
00807 
00808        m_streamRequest=STAT_OKAY;
00809 }
00810 
00811 void ObstacleAvoiderTransport::setGlobalName(const std::string & name){
00812        
00813        if(name=="Any"){
00814               return;
00815        }
00816 
00817        m_globalname=name;
00818        m_haveGlobalname=true;
00819        if(m_supplier){
00820               m_streamname=name;
00821        }
00822 
00823        if(myCOMObject){
00824               myCOMObject->setGlobalName(name);
00825        }
00826 }
00827 
00828 void ObstacleAvoiderTransport::doPing(){
00829        if(myCOMObject){
00830               myCOMObject->doPing();
00831        }
00832 }
00833 
00834 void ObstacleAvoiderTransport::setAutoPing(const bool & val){
00835        m_doAutoPing=val; 
00836        if(myCOMObject){
00837               myCOMObject->setAutoPing(val);
00838        }
00839 }
00840 
00841 

Generated on Thu Feb 1 15:31:53 2007 for WURDE by  doxygen 1.5.1