示例#1
0
void SpecificWorker::compute()
{   
    try
    {
		differentialrobot_proxy->getBaseState(bState);
		
		inner->updateTransformValues("robot", bState.x, 0, bState.z, 0, bState.alpha, 0);	//actualiza los valores del robot en el arbol de memoria
		ldata = laser_proxy->getLaserData();  //read laser data 

		switch( estado )
		{
			case State::INIT:
				break;
			case State::SEARCH:
				break;
			case State::PICK_NEW_POINT:
				estado = pickNewPoint();
				break;
			case State::PLAN:
				estado = plan();
				break;		
			case State::GOTO_POINTS:
				estado = gotoPoints();
				break;
			case State::VERIFY_POINT:
				estado = verifyPoint();
				break;	
			case State::TRAVELLING:
				estado = travelling();
				break;
			case State::FINISH:
				std::cout << "FINISH" << std::endl;
				sleep(1);
				estado = State::IDLE;
				break;
			case State::IDLE:
				break;
			case State::ERROR:
				qDebug() << "Error";
				break;
			} 
		}
    catch(const Ice::Exception e)
    {
      std::cout << e << std::endl;
    }
    
  innerViewer->update();
 	osgView->autoResize();
 	osgView->frame();
}
示例#2
0
void
read_engr_at(int x, int y)
{
    struct engr *ep = engr_at(level, x, y);
    int sensed = 0;

    /* Sensing an engraving does not require sight, nor does it necessarily
       imply comprehension (literacy). */
    if (ep && ep->engr_txt[0] &&
        /* Don't stop if travelling or autoexploring. */
        !(travelling() && level->locations[x][y].mem_stepped)) {
        switch (ep->engr_type) {
        case DUST:
            if (!Blind) {
                sensed = 1;
                pline("Something is written here in the %s.",
                      is_ice(level, x, y) ? "frost" : "dust");
            }
            break;
        case ENGRAVE:
        case HEADSTONE:
            if (!Blind || can_reach_floor()) {
                sensed = 1;
                pline("Something is engraved here on the %s.", surface(x, y));
            }
            break;
        case BURN:
            if (!Blind || can_reach_floor()) {
                sensed = 1;
                pline("Some text has been %s into the %s here.",
                      is_ice(level, x, y) ? "melted" : "burned", surface(x, y));
            }
            break;
        case MARK:
            if (!Blind) {
                sensed = 1;
                pline("There's some graffiti on the %s here.", surface(x, y));
            }
            break;
        case ENGR_BLOOD:
            /* "It's a message! Scrawled in blood!" "What's it say?" "It
               says... `See you next Wednesday.'" -- Thriller */
            if (!Blind) {
                sensed = 1;
                pline("You see a message scrawled in blood here.");
            }
            break;
        default:
            impossible("Something is written in a very strange way.");
            sensed = 1;
        }
        if (sensed) {
            /* AIS: Bounds check removed, because pline can now handle
               arbitrary-length strings */
            char *et = ep->engr_txt;
            pline("You %s: \"%s\".", (Blind) ? "feel the words" : "read", et);
            /* TODO: For now, engravings stop farmove, autoexplore, and
               travel. This can get quite spammy, though. */
            if (flags.occupation == occ_move ||
                flags.occupation == occ_travel ||
                flags.occupation == occ_autoexplore)
                action_interrupted();
        }
    }
}