Changeset 797


Ignore:
Timestamp:
01/05/2011 01:59:25 PM (10 years ago)
Author:
lmalek
Message:

rename module files in Player2Samgar

Location:
libs/SAMGAR/trunk/Modules/Samgar2Player
Files:
2 edited
4 moved

Legend:

Unmodified
Added
Removed
  • libs/SAMGAR/trunk/Modules/Samgar2Player/CMakeLists.txt

    r796 r797  
    1717 
    1818# set up our program 
    19 add_executable(Samgar2Player Samgar2Player.cpp PlayerSamgarModule.cpp PlayerSamgarThread.cpp) 
     19add_executable(Samgar2Player Samgar2Player.cpp Player2SamgarModule.cpp Player2SamgarThread.cpp) 
    2020 
    2121# link with YARP libraries 
  • libs/SAMGAR/trunk/Modules/Samgar2Player/Player2SamgarModule.cpp

    r796 r797  
    11/** \file PlayerSamgarModule.cpp 
    22 */ 
    3 #include "PlayerSamgarModule.h" 
     3#include "Player2SamgarModule.h" 
     4//#include "Player2SamgarThread.h" 
    45#include <iostream> 
    56 
     
    3132 
    3233 
    33 PlayerSamgarModule::PlayerSamgarModule(std::string hostname, uint port): 
     34Player2SamgarModule::Player2SamgarModule(std::string hostname, uint port): 
    3435  SamClass(std::string("/Player-")+hostname+"-"+itoa(port)), gHostname(hostname), gPort(port) 
    3536{ 
     
    8586} 
    8687 
    87 PlayerSamgarModule::~PlayerSamgarModule() 
     88Player2SamgarModule::~Player2SamgarModule() 
    8889{ 
    8990  // cancell all threads 
     
    120121} 
    121122 
    122 void PlayerSamgarModule::display() 
     123void Player2SamgarModule::display() 
    123124{ 
     125  std::cout<<"Found following Player drivers:"<<std::endl; 
    124126  for (std::list<PlayerDriver_t>::const_iterator 
    125127         it = drivers.begin(); it != drivers.end(); it++)  
    126128    {     
    127       std::cout << it->driverName <<" "<< it->interfName<<"("<< 
     129      std::cout <<"-> "<< it->driverName <<" "<< it->interfName<<"("<< 
    128130        it->interfID<<")"<<":"<<it->index <<" "<<it->host<< ":" 
    129131        <<it->port << std::endl; 
     
    131133} 
    132134 
    133 void PlayerSamgarModule::start() 
     135void Player2SamgarModule::start() 
    134136{ 
    135137  // start all threads 
     
    161163    } 
    162164} 
     165 
     166void Player2SamgarModule::join_threads() 
     167{ 
     168  for (std::list<pthread_t*>::iterator 
     169         it = threads.begin(); it != threads.end(); it++)  
     170    {  
     171      pthread_join(*(*it), NULL); 
     172    } 
     173} 
  • libs/SAMGAR/trunk/Modules/Samgar2Player/Player2SamgarModule.h

    r796 r797  
    1111#include <pthread.h> 
    1212#include "SamClass.h" 
    13 #include "PlayerSamgarThread.h" 
    1413 
    1514 
     15enum PlayerProxy_TYPE {Position2d, Localize, Planner, Laser, Map}; 
     16 
     17enum PlayerProxy_FIELDS {TYPE=0, CMD}; 
     18 
     19enum PlayerProxy_CMD {SET_REQ=0}; 
     20enum PlayerProxy_Position2d_CMD {Position2d_SET_SPEED=1, Position2d_SET_GOAL, Position2d_SET_ODOM, Position2d_SET_MOTOR}; 
     21enum PlayerProxy_Localize_CMD {Localize_SET_POSE=1}; 
     22enum PlayerProxy_Planner_CMD {Planner_SET_GOAL=1, Planner_SET_ENABLE}; 
     23enum PlayerProxy_Laser_CMD {Laser_SET_CONFIG=1}; 
     24 
     25enum PlayerProxy_DATA {Error=0, Ack=1}; 
     26 
     27enum PlayerProxy_Position2d_DATA {Position2d_SPEED=2, Position2d_POSITION, Position2d_SIZE, Position2d_STALL}; 
     28enum PlayerProxy_Localize_DATA {Localize_MAP_INFO=2, Localize_HYPOTHS}; 
     29enum PlayerProxy_Planner_DATA {Planner_GOAL=2, Planner_POSE, Planner_CURR_WAYPOINT, Planner_PATH, Planner_WAYPOINTS}; 
     30enum PlayerProxy_Laser_DATA {Laser_CONFIG=2, Laser_SIZE, Laser_POSE, Laser_ROBOT_POSE, Laser_POINTS, Laser_RANGES}; 
     31enum PlayerProxy_Map_DATA   {Map_MAP=2}; 
     32 
     33class PlayerDriver_t  
     34{ 
     35public: 
     36  std::string driverName; 
     37  std::string interfName; 
     38  int interfID; 
     39  int index; 
     40  long host; //IP addres of host writtedn in HEX in oposite dirrection and 
     41             //transfered to dec. i.e. 127.0.0.1 -> 1 00 00 7F -> 16777343 
     42  long port; 
     43  std::string player_hostname; 
     44  int player_port; 
     45  yarp::os::BufferedPort<yarp::os::Bottle>* samgarPort; 
     46}; 
     47 
     48void* Position2dThread(void * param); 
     49void* LocalizeThread(void * param); 
     50void* PlannerThread(void * param); 
     51void* LaserThread(void * param); 
     52void* MapThread(void * param); 
    1653 
    1754 
    18 class PlayerSamgarModule: public SamClass  
     55class Player2SamgarModule: public SamClass  
    1956{ 
    2057public: 
    21   PlayerSamgarModule(std::string hostname=PlayerCc::PLAYER_HOSTNAME, uint port=PlayerCc::PLAYER_PORTNUM); 
    22   ~PlayerSamgarModule(); 
     58  Player2SamgarModule(std::string hostname=PlayerCc::PLAYER_HOSTNAME, uint port=PlayerCc::PLAYER_PORTNUM); 
     59  ~Player2SamgarModule(); 
    2360  void start(); 
     61  void join_threads(); 
    2462  void display(); 
    2563  virtual void SamInit(){}; 
  • libs/SAMGAR/trunk/Modules/Samgar2Player/Player2SamgarThread.cpp

    r796 r797  
    11/** \file PlayerSamgarThread.h 
    22 */ 
    3 #include "PlayerSamgarThread.h" 
     3//#include "Player2SamgarThread.h" 
     4#include "Player2SamgarModule.h" 
    45#include <libplayerc++/playerc++.h> 
    56 
  • libs/SAMGAR/trunk/Modules/Samgar2Player/Player2SamgarThread.h

    r796 r797  
    11/** \file PlayerSamgarThread.h 
    22 */ 
    3 #ifndef PLAYERSAMGARTHREAD_H 
    4 #define PLAYERSAMGARTHREAD_H 
     3#ifndef PLAYER2SAMGARTHREAD_H 
     4#define PLAYER2SAMGARTHREAD_H 
    55 
    66#include <string> 
  • libs/SAMGAR/trunk/Modules/Samgar2Player/Samgar2Player.cpp

    r796 r797  
    55 */ 
    66 
    7 #include "PlayerSamgarModule.h" 
     7#include "Player2SamgarModule.h" 
    88 
    99int main(void)  
    1010{ 
    11   PlayerSamgarModule translator; 
     11  Player2SamgarModule translator; 
    1212  std::list<PlayerDriver_t> proxies; 
    1313  int prox_count; 
    1414  translator.display(); 
    1515  translator.start(); 
    16   //sleep(10); 
    17   while(1) 
    18     sleep(1); 
    19    
     16  translator.join_threads(); 
    2017  return 0; 
    2118} 
Note: See TracChangeset for help on using the changeset viewer.