Example #1
0
void load_destinations ( char *filename, map<string,Destination> &mine)
{
    string name;
    int x, y, a;
    Location loc_temp;
    Destination temp;
    ifstream myfile (filename);
    if (myfile.is_open())
    {
        while ( myfile.good() )
        {
            myfile >> name;
            myfile >> x;
            myfile >> y;
            myfile >> a;
            loc_temp.set(x,y,a);
            temp.set_Coordinate(loc_temp);

            temp.set_Name(name);
            mine.insert(std::make_pair( name,temp));
            cout <<temp.get_Name() << temp.get_Coordinate().get_X() <<endl;
        }
        myfile.close();
    }
}
Example #2
0
void Server :: readStatusFile(  QList<Destination> &destList )
{
    cleanUp();

    Destination *dest;
    QListIterator<Destination> dit( destList );
    bool rootRead = false;
    for ( ; dit.current(); ++dit )
    {
        dest = dit.current();
        bool installingToRoot = false;

        QString path = dest->getDestinationPath();
        if ( path.right( 1 ) != "/" )
            path.append( "/" );

        if ( path == "/" )
        {
            rootRead = true;
            installingToRoot = true;
        }

        packageFile = path;
        packageFile.append( "usr/lib/ipkg/status" );
        readPackageFile( 0, false, installingToRoot, &( *dest ) );
    }

    // Ensure that the root status file is read
    if ( !rootRead )
    {
        packageFile = "/usr/lib/ipkg/status";
        readPackageFile( 0, false, true );
    }
}
Example #3
0
Message::Message(const string& xml)
{
    XmlParser parser("Parser");
    Document doc;
    parser.parse(xml, doc);
    const Element& message = doc.getRootElement();
    if(message.getTagName()!="message")
    {
        throw InvalidMessageException("No message Tag\n");
    }
    else if(message.getChildElements().size()!=2)
    {
        throw InvalidMessageException("Every message should have a headers and body tag\n");
    }
    Element* headers = message.getChildElements().at(0);
    Element* body = message.getChildElements().at(1);
    if(headers->getTagName()!="headers")
    {
        throw InvalidMessageException("No headers Tag\n");
    }
    else if(body->getTagName()!="body")
    {
        throw InvalidMessageException("No body Tag\n");
    }
    Element* destination = headers->getElementByName("destination");
    Element* encoding = headers->getElementByName("encoding");
    Element* timestamp = headers->getElementByName("timestamp");
    Element* priority = headers->getElementByName("priority");
    Element* type = headers->getElementByName("type");
    Element* userid = headers->getElementByName("userid");
    if(destination->getTagName()!="destination")
    {
        throw InvalidMessageException("Destination Header is mandatory\n");
    }
    else if (destination->getAttributes().size()!=2)
    {
        throw InvalidMessageException("Type and Name Attributes should be speciifes for a Destination\n");
    }
    else if (destination->getAttribute("name")=="" || destination->getAttribute("type")=="")
    {
        throw InvalidMessageException("Type and Name Attributes cannot be blank for a Destination\n");
    }
    else if(type->getTagName()!="type")
    {
        throw InvalidMessageException("Type Header is mandatory\n");
    }
    Destination des;
    des.setName(destination->getAttribute("name"));
    des.setType(destination->getAttribute("type"));
    this->destination = des;
    this->body = body->getText();
    this->timestamp = timestamp->getText();
    this->type = type->getText();
    this->priority = priority->getText();
    this->userId = userid->getText();
    this->encoding = encoding->getText();
}
Example #4
0
Destination* DestList::Find(const char* label) {
	const int n = CountItems();
	// TODO: binary sort
	for (int32 i = 0; i < n; i++) {
		Destination* d = ItemAt(i);
		if (strcmp(d->Label(), label) == 0) return d;
	}
	return NULL;
}
 void apply(Source&& src, Destination& dest, boost::mpl::false_) const
 {
     try {
         dest.set_value(src.get());
     }
     catch (...) {
         dest.set_exception(boost::current_exception());
     }
 }
Example #6
0
bool AgentTravel::executeTravel( ActionTravel* p_action, Result& io_result ) {
    bool satisfiesConditions = false;

    Verb target = p_action->getTarget();
    Location location = m_ad->map[ m_ad->adventurer.getIdLocation() ];
    for( unsigned i = 0; i < location.getNumDestinations() && satisfiesConditions==false; i++ ) {
        Destination destination = location[ i ];

        // If the word does not correspond to any word used for travel at the current location - skip to the next destination:
        if( destination.canTravelToUsing( target )==false ) {
            continue;
        }
    
        unsigned x = location.getId();      // Current location.
        unsigned y = destination.getId();   // Possible location to which one might travel.
        unsigned m = y / 1000;              // How to travel (might actually not be travel, could even be a goto (!)).
        unsigned n = y % 1000;              // Conditions of travel.

        // Note to self, developer and the world: By 'prop', the original author apperently mean object - so the property value of said object.
        if( m == 0 ) { // if m=0 It's unconditional.
            satisfiesConditions = true;
        } else if( (m>0) && (m<100) ) { // if 0<m<100 It is done with m% probability.
            throw ExceptionAdventNotYetImplemented( "Travel - Probability." );
        } else if( m==100 ) { // if m=100 Unconditional, but forbidden to dwarves.
            throw ExceptionAdventNotYetImplemented( " Travel - Restrictions to dwarves apply." );
        } else if( (m>100) && (m<=200) ) { // if 100<m<=200 He must be carrying object m-100.
            satisfiesConditions = condObjectCarry(m-100);
        } else if( (m>200) && (m<=300) ) { // if 200<m<=300 Must be carrying or in same room as m-200.
            std::cout << "Required object: " << m-200 << std::endl;
            satisfiesConditions = condObjectCarry(m-200);
            if(satisfiesConditions)
                satisfiesConditions = condObjectLocation(m-200);    
        } else if( (m>300) && (m<=400) ) { // if 300<m<=400 prop(m mod 100) must *not* be 0.
            unsigned prop = m % 100;
            unsigned propValue = m_ad->map.getObject( prop ).getPropertyValue();
            if( propValue!=0 ) {
                satisfiesConditions = true;
            }
        } else if( (m>400) && (m <=500) ) { // if 400<m<=500 prop(m mod 100) must *not* be 1.
            throw ExceptionAdventNotYetImplemented( "Travel - prop(m mod 100) must *not* be 1." );
        } else if( (m>500) && (m <=600) ) { // if 500<m<=600 prop(m mod 100) must *not* be 2, etc.
            throw ExceptionAdventNotYetImplemented( "Travel - prop(m mod 100) must *not* be 2, etc." );
        }

        if( satisfiesConditions==true ) {
            if( n<=300 ) { // if n<=300 It is the location to go to.
                m_ad->adventurer.adventTravelTo( m_ad->map[ n ].getId() );
            } else if( (n>300) && (n<=500) ) { // if 300<n<=500 n-300 is used in a computed goto to a section of special code.
                throw ExceptionAdventNotYetImplemented( "Travel - GOTO." );
            } else if( n>500 ) { // if n>500 Message n-500 from section 6 is printed, and he stays wherever he is.
                io_result.setSummary(ResFormater::FormatLines( (*m_ad), m_ad->letterbox[ n ].lines ));
            }
        } 
    }

    return satisfiesConditions;
}
Example #7
0
 void apply(Source && src, Destination& dest, std::false_type) const
 {
     try {
         dest.set_value(src.get());
     }
     catch (...) {
         dest.set_exception(std::current_exception());
     }
 }
Example #8
0
 void apply(Source && src, Destination& dest, std::true_type) const
 {
     try {
         src.get();
         dest.set_value(util::unused);
     }
     catch (...) {
         dest.set_exception(std::current_exception());
     }
 }
 void apply(Source&& src, Destination& dest, boost::mpl::true_) const
 {
     try {
         src.get();
         dest.set_result(util::unused);
     }
     catch (...) {
         dest.set_exception(boost::current_exception());
     }
 }
Example #10
0
bool XRefDests::Find(XRefDef* def, const char* label, int32* page, BRect* boundingBox) const {
	DestList* list = GetList(def);
	ASSERT(list != NULL);
	Destination* dest = list->Find(label);
	if (dest) {
		*page = dest->Page();
		*boundingBox = dest->BoundingBox();
		return true;
	}
	return false;
}
Example #11
0
	void vmessage(Severity severity, const char* fmt, va_list ap){
		static char buf[255]; /* this isn't thread-safe anyway, might as well make it static */

		std::unique_ptr<char, free_delete> content(vasprintf2(fmt, ap));
		std::unique_ptr<char, free_delete> decorated(asprintf2("(%s) [%s] %s", severity_string(severity), timestring(buf, 255), content.get()));

		for ( iterator it = destinations.begin(); it != destinations.end(); ++it ){
			if ( severity < it->second ) continue;
			Destination* dst = it->first;
			dst->write(content.get(), decorated.get());
		}
	}
Example #12
0
void Maze::FindAllPaths(int x, int y, Route *route) {
	if (x < 0 || y < 0 || x >= mazeSize.width || y >= mazeSize.height || maze[x][y] == '#' || maze[x][y] == 1)
		return;

	maze[x][y] = 1;
	Point p;
	p.x = x;
	p.y = y;
	route->AddPointToRoute(p);

	//Search point in destinations
	Destination* destination = 0;

	for (int i = 0; i < cntDestinations; i++)
	{
		Destination* tempDest = Destinations[i];
		Point point = tempDest->GetEndPoint();
		if (point.x == p.x && point.y == p.y)
		{
			destination = Destinations[i];
			break;
		}
	}

	if (destination == 0)
	{
		destination = new Destination();
		destination->SetEndPoint(p);
		Destinations[cntDestinations] = destination;
		cntDestinations++;
	}

	//Clone route
	Route* newRoute = new Route();
	int numPoints = route->GetCntPoints();
	Point* oldRoutePoints =route->GetPoints();

	for (int i = 0; i < numPoints; i++)
		newRoute->AddPointToRoute(oldRoutePoints[i]);
	destination->AddRoute(*newRoute);

	FindAllPaths(x, y + 1, route);
	FindAllPaths(x + 1, y, route);
	FindAllPaths(x, y - 1, route);
	FindAllPaths(x - 1, y, route);

	if (route->GetCntPoints() > 0)
		route->DeletePoint();

	maze[x][y] = 0;
}
Example #13
0
void Maze::PrintAllDestinations(int x, int y) {

	Route route = Route();
	FindAllPaths(x, y, &route);

	cout << "Destinations:" << endl;
	for (int i = 0; i < cntDestinations; i++)
	{
		if (Destinations[i]->GetEndPoint().x == x && Destinations[i]->GetEndPoint().y == y)
			continue;

		Point destEndPoint = Destinations[i]->GetEndPoint();
		cout << '(' << destEndPoint.x << "," << destEndPoint.y << ") ";
	}

	cout << endl << "Routes:" << endl;
	for (int i = 0; i < cntDestinations; i++)
	{
		if (Destinations[i]->GetEndPoint().x == x && Destinations[i]->GetEndPoint().y == y)
			continue;

		Destination* destination = Destinations[i];
		int cntRoutes = destination->GetCntRoutes();
		Route* routes = new Route[cntRoutes];
		destination->SortRoutes();
		routes = destination->GetRoutes();

		Point destEndPoint = destination->GetEndPoint();
		cout << '(' << destEndPoint.x << "," << destEndPoint.y << ") " << endl;

		for (int j = 0; j < cntRoutes; j++)
		{
			Route route = routes[j];
			Point* points = route.GetPoints();
			int cntPoints = route.GetCntPoints();

			for (int k = 0; k < cntPoints; k++)
			{
				Point point = points[k];
				cout << '(' << point.x << "," << point.y << ") ";//<<endl;
			}
			cout << endl;
		}
	}
}
Example #14
0
	static void add_destination(Severity severity, FILE* dst, bool autoclose){
		Destination* o = new Destination(severity, dst, false);
		output.push_back(o);

		if ( dst == stdout || dst == stderr ){
			return;
		}

#ifdef HAVE_GETTIMEOFDAY
		struct timeval tv;
		gettimeofday(&tv, nullptr);
		struct tm* local = localtime(&tv.tv_sec);
#else
		__time64_t tv;
		struct tm tm, *local = &tm;
        _time64(&tv);
        _localtime64_s(local, &tv);
#endif

		char buf[64] = {0,};
		strftime(buf, sizeof(buf), "\nLogging started at %Y-%m-%d %H.%M.%S\n", local);
		o->write(INFO, buf);
	}
Example #15
0
Destination *UdpDestination::duplicate()
{
	Destination *d = new UdpDestination(ip_addr, port, ignorePort);
	if (d && name) d->setName(name);
	return d;
}
Example #16
0
/**
 * \brief Adds an entity to the map.
 *
 * This function is called when loading the map. If the entity
 * specified is NULL (because some entity creation functions
 * may return NULL), nothing is done.
 *
 * \param entity The entity to add (can be NULL).
 */
void MapEntities::add_entity(MapEntity* entity) {

  if (entity == NULL) {
    return;
  }

  if (entity->get_type() == TILE) {
    // Tiles are optimized specifically for obstacle checks and rendering.
    add_tile(static_cast<Tile*>(entity));
  }
  else {
    Layer layer = entity->get_layer();

    // update the detectors list
    if (entity->is_detector()) {
      detectors.push_back(static_cast<Detector*>(entity));
    }

    // update the obstacle list
    if (entity->can_be_obstacle()) {

      if (entity->has_layer_independent_collisions()) {
        // some entities handle collisions on any layer (e.g. stairs inside a single floor)
        obstacle_entities[LAYER_LOW].push_back(entity);
        obstacle_entities[LAYER_INTERMEDIATE].push_back(entity);
        obstacle_entities[LAYER_HIGH].push_back(entity);
      }
      else {
        // but usually, an entity collides with only one layer
        obstacle_entities[layer].push_back(entity);
      }
    }

    // update the ground observers list
    if (entity->is_ground_observer()) {
      ground_observers[layer].push_back(entity);
    }

    // update the ground modifiers list
    if (entity->is_ground_modifier()) {
      ground_modifiers[layer].push_back(entity);
    }

    // update the sprites list
    if (entity->is_drawn_in_y_order()) {
      entities_drawn_y_order[layer].push_back(entity);
    }
    else if (entity->can_be_drawn()) {
      entities_drawn_first[layer].push_back(entity);
    }

    // update the specific entities lists
    switch (entity->get_type()) {

      case STAIRS:
        stairs[layer].push_back(static_cast<Stairs*>(entity));
        break;

      case CRYSTAL_BLOCK:
        crystal_blocks[layer].push_back(static_cast<CrystalBlock*>(entity));
        break;

      case SEPARATOR:
        separators.push_back(static_cast<Separator*>(entity));
        break;

      case BOOMERANG:
        this->boomerang = static_cast<Boomerang*>(entity);
        break;

      case DESTINATION:
        {
          Destination* destination = static_cast<Destination*>(entity);
          if (this->default_destination == NULL || destination->is_default()) {
            this->default_destination = destination;
            break;
          }
        }

      default:
      break;
    }

    // update the list of all entities
    all_entities.push_back(entity);
  }

  const std::string& name = entity->get_name();
  if (!name.empty()) {
    Debug::check_assertion(named_entities.find(name) == named_entities.end(),
        StringConcat()
        << "An entity with name '" << name << "' already exists.");
    named_entities[name] = entity;
  }
  entity->increment_refcount();

  // notify the entity
  entity->set_map(map);
}
Example #17
0
 void apply(Source src, Destination& dest, boost::mpl::true_) const
 {
     src.get();
     dest->set_data(util::unused);
 }
Example #18
0
 void apply(Source src, Destination& dest, boost::mpl::false_) const
 {
     dest->set_data(src.get());
 }
RtpSessionError CRtpSessionVideo::SendData(CPacket* packet)
{
  RtpSessionError ret = AM_RTP_SESSION_ERROR_OK;
  AM_U32           id = packet->GetStreamId();

  if (AM_LIKELY(id == mStreamId)) {
    AM_U32     packetNum = 0;
    AM_U32          size = packet->GetDataSize();
    AM_U8          *data = packet->GetDataPtr();
    RtspPacket  *packets = NULL;
    AM_S32 pktPtsIncr90k = (mOldPts > 0) ? (AM_S32)(packet->GetPTS()-mOldPts) :
        ((mVideoInfo.type == 1) ? (AM_S32)((AM_U64)mVideoInfo.rate *
            90000LLU / (AM_U64)mVideoInfo.scale) :
            (AM_S32)((AM_U64)mVideoInfo.fps * 90000LLU / 512000000LLU));

    mOldPts = packet->GetPTS();

    switch(mVideoInfo.type) {
      case 1: { /* H.264 */
        packets = mPackager->assemblePacketH264(data, size, mMaxPacketSize,
                                                packetNum, mSeqNum,
                                                mCurrentTimeStamp,
                                                mSsrc, pktPtsIncr90k);
      }break;
      case 2: { /* MJPEG */
        AM_U8 qfactor = (0xff & packet->mPayload->mData.mFrameAttr);
        packets = mPackager->assemblePacketJpeg(data, qfactor, size,
                                                mMaxPacketSize, packetNum,
                                                mSeqNum, mCurrentTimeStamp,
                                                mSsrc, pktPtsIncr90k);
      }break;
      default: {
        ERROR("Invalid video type!");
      }break;
    }
    packet->SetStreamId(mOldStreamId);
    packet->Release();
    if (AM_LIKELY(packets)) {
      AUTO_LOCK(mMutex);

      for (AM_UINT i = 0; i < packetNum; ++ i) {

        if (AM_LIKELY(HaveDestination(id))) {

          if (AM_UNLIKELY(!mRtspServer->SendPacket(mDestination,
                                                   &packets[i]))) {
            ERROR("Failed to send video NALU");
            ret = AM_RTP_SESSION_ERROR_NETWORK;
            break;
          }
        }
        /* No destination, just ignore */
        ret = AM_RTP_SESSION_ERROR_OK;
      }
      for (Destination *dest = mDestination; dest; dest = dest->next) {
        if (dest->enable) {
          dest->update_sent_data_info(mCurrentTimeStamp,
                                      GetNtpTime(),
                                      packetNum,
                                      size);
          if (AM_UNLIKELY(dest->sendsr)) {
            dest->update_rtcp_sr(mCurrentTimeStamp,
                                 90000,
                                 GetNtpTime());
            if (AM_LIKELY(dest->sendsr)) {
              mRtspServer->SendRtcpSr(dest);
              dest->sendsr = false;
            }
          }
        }
      }
    } else {
      ret = AM_RTP_SESSION_ERROR_BITSTREAM;
      ERROR("Failed to build RTP packet!");
    }
  } else {
    ERROR("No such session %u", packet->GetStreamId());
    ret = AM_RTP_SESSION_ERROR_NOSESSION;
    /* Audio stream's id is set to MAX_ENCODE_STREAM_NUM to distinguish it
     * from video stream, before release it we need to reset its stream id
     * to its original one, AVQueue need its original stream id to release
     * memory
     */
    packet->SetStreamId(mOldStreamId);
    packet->Release();
  }

  return ret;
}
Example #20
0
void RunLaps::executePlay(VisionData* vision, RobocupStrategyData* rsd)
{
  for (RobotIndex robot = ROBOT0; robot < NUM_ROBOTS; robot++)
  {
    if (rsd->getPositionOfRobot(robot) != NO_POSITION) {
      Destination* command = rsd->getDestination(robot);
      command->setSpeed(DEFAULT_SPEED);
      command->setControl(OMNI_NORMAL_ENTERBOX);
      const SystemParameters& p = rsd->getSystemParams();

      switch(lapState[robot])
      {
      case runningUp:
        rsd->setMessage(robot, "Running Up the field");
        command->setPos(p.field.THEIR_GOAL_LINE - DIST_FROM_TARGET_WALL, p.field.LEFT_SIDE_LINE - DIST_FROM_OTHER_WALL);
        command->setRotation(0);
        if(getXLocation(robot, *vision, p) > p.field.THEIR_GOAL_LINE - THRESH_DIST_FROM_WALL)
        {
          lapState[robot] = runningRight;
        }
        break;
      case runningRight:
        rsd->setMessage(robot, "Running right");
        command->setPos(p.field.THEIR_GOAL_LINE - DIST_FROM_OTHER_WALL, p.field.RIGHT_SIDE_LINE + DIST_FROM_TARGET_WALL);
        command->setRotation(-PI/2);
        if(getYLocation(robot, *vision, p) < p.field.RIGHT_SIDE_LINE + THRESH_DIST_FROM_WALL)
        {
          lapState[robot] = runningDown;
        }
        break;
      case runningDown:
        rsd->setMessage(robot, "Running down the field");
        command->setPos(p.field.OUR_GOAL_LINE + DIST_FROM_TARGET_WALL, p.field.RIGHT_SIDE_LINE + DIST_FROM_OTHER_WALL);
        command->setRotation(PI);
        if(getXLocation(robot, *vision, p) < p.field.OUR_GOAL_LINE + THRESH_DIST_FROM_WALL)
        {
          lapState[robot] = runningLeft;
        }
        break;
      case runningLeft:
        rsd->setMessage(robot, "Running left");
        command->setPos(p.field.OUR_GOAL_LINE + DIST_FROM_OTHER_WALL, p.field.LEFT_SIDE_LINE - DIST_FROM_TARGET_WALL);
        command->setRotation(PI/2);
        if(getYLocation(robot, *vision, p) > p.field.LEFT_SIDE_LINE - THRESH_DIST_FROM_WALL)
        {
          lapState[robot] = runningUp;
        }
        break;
      default:
        rsd->setMessage(robot, "internal error in runLaps");
        break;
      }

      command->setRotation(0);
    }
  }
}
void PredictionTestPlay::executePlay(VisionData* vision, RobocupStrategyData* rsd)
{
  for (RobotIndex robot = ROBOT0; robot < NUM_ROBOTS; robot++)
  {
    if (rsd->getPositionOfRobot(robot) != NO_POSITION) {
      Destination* command = rsd->getDestination(robot);
      command->setSpeed(DEFAULT_SPEED);
      command->setControl(OMNI_NORMAL_ENTERBOX);
      const SystemParameters& p = rsd->getSystemParams();

      switch(testLapState[robot])
      {
      case runningUpLong:
				if( testWaitState[robot] == waiting )
				{
					if( waitCounter < MAX_WAIT )
					{
						waitCounter++;
						rsd->setMessage(robot, "Waiting...");
						command->setRotation(rot);
					}
					else
					{
						testLapState[robot] = runningRightCross;
						testWaitState[robot] = running;
						waitCounter = 0;
					}
				}
				else
				{
					rsd->setMessage(robot, "Running Up the field");
					command->setPos(p.field.THEIR_GOAL_LINE - DIST_FROM_TARGET_WALL, p.field.LEFT_SIDE_LINE - DIST_FROM_OTHER_WALL);
					command->setRotation(rot);
					if(getXLocation(robot, *vision, p) > p.field.THEIR_GOAL_LINE - THRESH_DIST_FROM_WALL)
						testWaitState[robot] = waiting;
				}
        break;
      case runningRightCross:
				if( testWaitState[robot] == waiting )
				{
					if( waitCounter < MAX_WAIT )
					{
						waitCounter++;
						rsd->setMessage(robot, "Waiting...");
						command->setRotation(rot);
					}
					else
					{
						testLapState[robot] = runningDownLong;
						testWaitState[robot] = running;
						waitCounter = 0;
					}
				}
				else
				{
					rsd->setMessage(robot, "Running right");
					command->setPos(p.field.THEIR_GOAL_LINE - DIST_FROM_OTHER_WALL, p.field.RIGHT_SIDE_LINE + DIST_FROM_TARGET_WALL);
					command->setRotation(rot);
					if(getYLocation(robot, *vision, p) < p.field.RIGHT_SIDE_LINE + THRESH_DIST_FROM_WALL)
						testWaitState[robot] = waiting;
				}
        break;
      case runningDownLong:
				if( testWaitState[robot] == waiting )
				{
					if( waitCounter < MAX_WAIT )
					{
						waitCounter++;
						rsd->setMessage(robot, "Waiting...");
						command->setRotation(rot);
					}
					else
					{
						testLapState[robot] = runningLeftCross;
						testWaitState[robot] = running;
						waitCounter = 0;
					}
				}
				else
				{
					rsd->setMessage(robot, "Running down the field");
					command->setPos(p.field.OUR_GOAL_LINE + DIST_FROM_TARGET_WALL, p.field.RIGHT_SIDE_LINE + DIST_FROM_OTHER_WALL);
					command->setRotation(rot);
					if(getXLocation(robot, *vision, p) < p.field.OUR_GOAL_LINE + THRESH_DIST_FROM_WALL)
						testWaitState[robot] = waiting;
				}
        break;
      case runningLeftCross:
				if( testWaitState[robot] == waiting )
				{
					if (waitCounter < MAX_WAIT )
					{
						waitCounter++;
						rsd->setMessage(robot, "Waiting...");
						command->setRotation(rot);
					}
					else
					{
						testLapState[robot] = runningUpLong;
						testWaitState[robot] = running;
						waitCounter = 0;
						//finished lap, so turn 45 degrees,and do another
						rot += PI/4;
						normalizeAngle(rot);
					}
				}
				else
				{
					char output[200];
					sprintf(output, "Running left, rot = %.2f", rot);
					rsd->setMessage(robot,output);
					command->setPos(p.field.OUR_GOAL_LINE + DIST_FROM_OTHER_WALL, p.field.LEFT_SIDE_LINE - DIST_FROM_TARGET_WALL);
					command->setRotation(rot);
					if(getYLocation(robot, *vision, p) > p.field.LEFT_SIDE_LINE - THRESH_DIST_FROM_WALL)
						testWaitState[robot] = waiting;
				}
        break;
      default:
        rsd->setMessage(robot, "internal error in prediction_test_play");
        break;
      }
    }
  }
}