示例#1
0
void TeamDataSender::update(TeamDataSenderOutput& teamDataSenderOutput)
{
  if(theTeamMateData.sendThisFrame)
  {
    ++sendFrames;

    // Own pose information and ball observation:
    TEAM_OUTPUT(idTeamMateRobotPose, bin, RobotPoseCompressed(theRobotPose));
    TEAM_OUTPUT(idTeamMateSideConfidence, bin, theSideConfidence);
    TEAM_OUTPUT(idTeamMateBallModel, bin, BallModelCompressed(theBallModel));

    // Obstacle stuff
    TEAM_OUTPUT(idObstacleClusters, bin, ObstacleClustersCompressed(theObstacleClusters, maxNumberOfObstacleClustersToSend));
    TEAM_OUTPUT(idTeamMateRobotsModel, bin, RobotsModelCompressed(theRobotsModel, maxNumberOfRobotsToSend));
    TEAM_OUTPUT(idTeamMateObstacleModel, bin,ObstacleModelCompressed(theObstacleModel, maxNumberOfObstaclesToSend));

    // Robot status
    TEAM_OUTPUT(idTeamMateIsPenalized, bin, (theRobotInfo.penalty != PENALTY_NONE));
    TEAM_OUTPUT(idTeamMateHasGroundContact, bin, theGroundContactState.contact);
    TEAM_OUTPUT(idTeamMateIsUpright, bin, (theFallDownState.state == theFallDownState.upright));
    if(theGroundContactState.contact)
      TEAM_OUTPUT(idTeamMateTimeSinceLastGroundContact, bin, theFrameInfo.time);
    TEAM_OUTPUT(idTeamCameraHeight, bin, theCameraMatrix.translation.z);

    if(sendFrames % 20 == 0)
      TEAM_OUTPUT(idRobotHealth, bin, theRobotHealth);
  }
}
void TeamDataSender::update(TeamDataSenderOutput& teamDataSenderOutput)
{
  if(theTeammateData.sendThisFrame)
  {
    ++sendFrames;

    TEAM_OUTPUT(idRobot, bin, theRobotInfo.number);

    // Own pose information and ball observation:
    TEAM_OUTPUT(idRobotPose, bin, RobotPoseCompressed(theRobotPose));
    TEAM_OUTPUT(idSideConfidence, bin, theSideConfidence);
    TEAM_OUTPUT(idBallModel, bin, BallModelCompressed(theBallModel));
    TEAM_OUTPUT(idTeammateBallAge, bin, static_cast<float>(theBallModel.timeWhenLastSeen ? theFrameInfo.getTimeSince(theBallModel.timeWhenLastSeen) / 1000.f : -1.f));

    TEAM_OUTPUT(idFieldFeatureOverview, bin, theFieldFeatureOverview);

    // Obstacle stuff
    TEAM_OUTPUT(idObstacleModelCompressed, bin, ObstacleModelCompressed(theObstacleModel, maxNumberOfObstaclesToSend));

    // Information about the behavior (i.e. the robot's state and intentions)
    TEAM_OUTPUT(idBehaviorStatus, bin, theBehaviorStatus);
    TEAM_OUTPUT(idSPLStandardBehaviorStatus, bin, theSPLStandardBehaviorStatus);
    TEAM_OUTPUT(idTeammateRoles, bin, theTeammateRoles);

    // Robot status
    TEAM_OUTPUT(idTeammateIsPenalized, bin, (theRobotInfo.penalty != PENALTY_NONE));
    TEAM_OUTPUT(idTeammateHasGroundContact, bin, (theGroundContactState.contact && theMotionInfo.motion != MotionInfo::getUp && theMotionRequest.motion != MotionRequest::getUp));
    TEAM_OUTPUT(idTeammateIsUpright, bin, (theFallDownState.state == theFallDownState.upright));
    if(theGroundContactState.contact)
    {
      TEAM_OUTPUT(idTeammateTimeOfLastGroundContact, bin, theFrameInfo.time);
    }

    TEAM_OUTPUT(idWhistle, bin, theWhistle);

    TEAM_OUTPUT(idTeammateFieldCoverage, bin, FieldCoverageLineCompressed(theFieldCoverage[lineToSendNext++ % FieldCoverage::numOfCellsY]));

    if(sendFrames % 20 == 0)
    {
      TEAM_OUTPUT(idRobotHealth, bin, theRobotHealth);
    }

    //TEAM_OUTPUT(idNetworkThumbnail, bin, theNetworkThumbnail);
  }
}
TeammateDataCompressed::TeammateDataCompressed(const TeammateData& teammateData)
{
  currentTimestamp = teammateData.currentTimestamp;
  firstTeammate = teammateData.firstTeammate;
  for(int i = TeammateData::firstPlayer; i < TeammateData::numOfPlayers; ++i)
  {
    timeStamps[i] = teammateData.timeStamps[i];
    isActive[i] = teammateData.isActive[i];
    isFullyActive[i] = teammateData.isFullyActive[i];
    ballModels[i] = BallModelCompressed(teammateData.ballModels[i]);
    robotPoses[i] = RobotPoseCompressed(teammateData.robotPoses[i]);
    robotsSideConfidence[i] = teammateData.robotsSideConfidence[i];
    roles[i] = teammateData.behaviorStatus[i].role;
    walkingTo[i] = teammateData.walkingTo[i];
    intention[i] = teammateData.intention[i];
  }
  dropInData = teammateData.dropInData;
}