Esempio n. 1
0
LocalRobot::LocalRobot()
  : RobotConsole(theDebugReceiver, theDebugSender),
    theDebugReceiver(this, "Receiver.MessageQueue.O"),
    theDebugSender(this, "Sender.MessageQueue.S"),
    image(false),
    nextImageTimeStamp(0),
    imageLastTimeStampSent(0),
    jointLastTimeStampSent(0),
    updatedSignal(1),
    puppet(0)
{
  mode = ((ConsoleRoboCupCtrl*)RoboCupCtrl::controller)->getMode();
  addViews();

  if(mode == SystemCall::logfileReplay)
  {
    logFile = ((ConsoleRoboCupCtrl*)RoboCupCtrl::controller)->getLogFile();
    logPlayer.open(logFile.c_str());
    logPlayer.handleAllMessages(annotationInfos['c']);
    logPlayer.play();
    puppet = (SimRobotCore2::Body*)RoboCupCtrl::application->resolveObject("RoboCup.puppets." + robotName, SimRobotCore2::body);
    if(puppet)
      simulatedRobot.init(puppet);
  }
  else if(mode == SystemCall::simulatedRobot)
  {
    SimRobotCore2::Body* robot = (SimRobotCore2::Body*)RoboCupCtrl::application->resolveObject(RoboCupCtrl::getRobotFullName(), SimRobotCore2::body);
    ASSERT(robot);
    simulatedRobot.init(robot);
    ctrl->gameController.registerSimulatedRobot(robotName.mid(5).toInt() - 1, simulatedRobot);
  }
}
Esempio n. 2
0
LocalRobot::LocalRobot()
: RobotConsole(theDebugReceiver,theDebugSender),
theDebugReceiver(this,"Receiver.MessageQueue.O",false),
theDebugSender(this,"Sender.MessageQueue.S",false),
imageTimeStamp(0),
imageLastTimeStampSent(0)
{
  mode = ConsoleRoboCupCtrl::getMode();
  addViews();

  if(mode == SystemCall::logfileReplay)
  {
    logFile = ConsoleRoboCupCtrl::getLogFile();
    logPlayer.open(logFile.c_str());
    logPlayer.play();
  }
  else if(mode == SystemCall::simulatedRobot)
  {
    oracle.init();
  }
}