something about Blobfinder use in stage

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

something about Blobfinder use in stage

Hello everyone,
 I am a student in shanghai jiaotong university,these days I am studying player stage,Here i have some problems.

for fast running ,I programed in stage ,not used proxy in player.
I have used blobfinder to test some rubbishes , in world file is:
        # create another robot
  name "r1"
  color "red"

  pose [-5.5 -3.5 0 208]
 ctrl "src/"
# report error-free position in world coordinates
  localization "gps"
  localization_origin [ 0 0 0 0 ]

        colors_count 2
        colors [ "green" "purple"  ]
                alwayson 1
                range 4.0
                fov 60

but when i run my stage program by "stage imbar.wold", the image box with the robot can see the green color,that means our blobfinder detected a rubbish but the program output is not.the program is:(in .cc file )

int BlobfinderUpdate( Model* mod, iRobot* robot );
#define MAXROBOT 1000
iRobot* robotRef[MAXROBOT];
//Stage calls this when the model starts up
extern "C" int Init( Model* mod, CtrlArgs* args )
        iRobot* robot = new iRobot(mod);
        robotRef[robot->id] = robot;
        robot->pos->AddUpdateCallback( (stg_model_callback_t)PositionUpdate, robot );
        robot->laser->AddUpdateCallback( (stg_model_callback_t)LaserUpdate, robot );
        robot->blob->AddUpdateCallback( (stg_model_callback_t)BlobfinderUpdate, robot);

        robot->laser->Subscribe(); // starts the laser updates
        robot->pos->Subscribe(); // starts the position updates
        robot->blob->Subscribe();//starts the blobfinder updates
        return 0; //ok
int BlobfinderUpdate(Model* mod,iRobot* robot)
    uint32_t bcount = 10;
        std::cout<<"befor test is blob count is:"<<bcount<<std::endl;//out put initial count
    ModelBlobfinder::Blob* blobtemp = robot->blob->GetBlobs(&bcount);//?have problem?
        std::cout<<"after test is blob count is:"<<bcount<<std::endl;
            std::cout<<"blob see "<<bcount<<"blobs"<<std::endl;
            std::cout<<"going to clear the RUBBISH"<<std::endl;
        return 0;

so after programed  "ModelBlobfinder::Blob* blobtemp = robot->blob->GetBlobs(&bcount); "
the bcount should changed form 10 (initial data) to 1 because detected a green rubbish.
but the proaram alway outout like this:

befor test is blob count is:10
after test is blob count is:0

the problem trouble me some days ,really need you help ,thank you very much .