本文整理汇总了C++中PlayerManager::waitForData方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerManager::waitForData方法的具体用法?C++ PlayerManager::waitForData怎么用?C++ PlayerManager::waitForData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerManager
的用法示例。
在下文中一共展示了PlayerManager::waitForData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
MssArgs * args = new MssArgs(argc, argv);
// Create PlayerManager
PlayerManager *pm = new PlayerManager(10, args->playerHostname, args->playerPort, args->verbosity);
// Create PositionDevice
PlayerPosition2D *pp2d = new PlayerPosition2D(pm, POSITION2D_INDEX, VFH_POSE_INDEX, AMCL_LOCALIZE_INDEX, args->verbosity);
//PlayerPosition2D *pp2d = new PlayerPosition2D(pm, POSITION2D_INDEX, VFH_POSE_INDEX, POSITION2D_INDEX, args->verbosity);
//PlayerPosition2D *pp2d = new PlayerPosition2D(pm, POSITION2D_INDEX, VFH_POSE_INDEX, VFH_POSITION_INDEX, args->verbosity);
PlayerLaser pl(pm, LASER_INDEX, args->verbosity);
PlayerBlobfinder *pbf = new PlayerBlobfinder(pm, BLOBFINDER_INDEX, args->verbosity);
PlayerGripper *pg = new PlayerGripper(pm, GRIPPER_INDEX, args->verbosity);
PlayerPtz *ptz = new PlayerPtz(pm, PTZ_INDEX, args->verbosity);
// Create MapDevice
PlayerMap *pmap = new PlayerMap(pm, 0, args->verbosity);
// Create PlannerDevice
//PlayerPlanner *pplan = new PlayerPlanner(pm, pp2d, pmap, POSITION2D_INDEX, true, args->verbosity, 0.3);
//PlayerLocalization *ploc = new PlayerLocalization(pm, pp2d, 100, AMCL_LOCALIZE_INDEX, args->verbosity);
PlayerPlanner *pplan = new PlayerPlanner(pm, pp2d, pmap, AMCL_LOCALIZE_INDEX, true, args->verbosity, 0.3);
RobotManipulation *rm = new RobotManipulation(pm, pp2d, pg, pbf, ptz, args->verbosity);
//parameter
BlobColorType color1 = GREEN;
BlobColorType color2 = RED;
BlobColorType color = GREEN;
playerc_blobfinder_blob_t blob;
playerc_blobfinder_blob_t blob1;
playerc_blobfinder_blob_t blob2;
// Enable motors
pp2d->powerUp();
// Initialize Odometry to (0,0,0)
pp2d->setOdometry(args->startX, args->startY, DTOR(args->startPhi));
pg->moveDown();
pg->open();
//double pose[100][3] = {};
//cout << ploc->getHypothCount() << endl;
//ploc->localize(pp2d, pose);
//ploc->getHypoth(1, pose);
//cout << "plocpos\t" << pose[0] << "\t" << pose[1] << "\t" << pose[2] << std::endl;
cout << "pp2dpos\t" << pp2d->getXPos() << "\t" << pp2d->getYPos() << std::endl;
//2-dimensional array of search points
clock_t start, finish;
double duration = 0;
double startX = args->startX;
double startY = args->startY;
//double searchPoint[4][2] = {{startX,startY},{1,-1},{1,1},{-1,1}};
double searchPoint[3][2] = {{startX,startY},{-1.3,1.3},{-1.5,-1.5}};
double goalX = 0;
double goalY = 0;
double phi = 0;
bool flag = 0;
int pointNum = 0;
//int windowWidth = 0;
// main loop
while( pointNum < 3 )
{
duration = 0;
start = clock();
flag = 0;
//if the roboter on the start positon, just turn 1/4 circle
if(abs(pp2d->getXPos()-startX)<0.2&&abs(pp2d->getYPos()-startY)<0.2)
{
pp2d->goToPose(startX,startY,DTOR(-90));
while(!pp2d->getReached())
{
pm->waitForData();
}
//while(!pbf->blobFound(color1)&&!pbf->blobFound(color2)&&duration<1)
cout << "No Blob! Searching!" << endl;
pp2d->goToPose(startX,startY,DTOR(-180));
while(!pp2d->getReached())
{
pm->waitForData();
if((pbf->blobFound(color1)||pbf->blobFound(color2)))
{
if(pbf->blobFound(color1)&&abs((int)blob.area>80))
{
pbf->getBiggestBlob(color1, blob);
flag = 1;
break;
}
if(pbf->blobFound(color2)&&abs((int)blob.area>80))
{
pbf->getBiggestBlob(color2, blob);
if((blob.right-blob.left)<(blob.bottom-blob.top))
{
//.........这里部分代码省略.........