"Sending Definition Response." + " Request Timestamp: {0}, Type: {1}, Source: {2}, Dest: {3}, Robot: {4}.", new Object[]{req.getTimestampMillisecUTC(), req.getRequestType(), req.getSourceId(), req.getDestinationId(), req.getRobotId()}); if(myResponseSender == null){ theLogger.log(Level.INFO, "Unable to send Definition Response, missing ResponseSender." + " Request Timestamp: {0}, Type: {1}, Source: {2}, Dest: {3}, Robot: {4}.", new Object[]{req.getTimestampMillisecUTC(), req.getRequestType(), req.getSourceId(), req.getDestinationId(), req.getRobotId()}); return; + " Request Timestamp: {0}, Type: {1}, Source: {2}, Dest: {3}, Robot: {4}." + " Using Header: {5}, Robot: {6}", new Object[]{req.getTimestampMillisecUTC(), req.getRequestType(), req.getSourceId(), req.getDestinationId(), req.getRobotId(), header, robot}); RobotDefinitionResponse def = "Definition Response Sent." + " Request Timestamp: {0}, Type: {1}, Source: {2}, Dest: {3}, Robot: {4}.", new Object[]{req.getTimestampMillisecUTC(), req.getRequestType(), req.getSourceId(), req.getDestinationId(), req.getRobotId()});
private RobotResponseHeader getHeader(RobotRequest req){ return myResponseFactory.createHeader( getRobotId(), mySourceId, myDestinationId, req.getRequestType(), req.getTimestampMillisecUTC()); }
private boolean isMatch(RobotRequest req, RobotResponseHeader resp){ if(req == null || resp == null){ theLogger.info("Received null request or response header, unable to determine match."); throw new NullPointerException(); } if(!req.getRobotId().equals(resp.getRobotId())){ theLogger.log(Level.INFO, "Requested Robot Id ({0}) does not match Response Robot Id ({1}).", new Object[]{req.getRobotId(), resp.getRobotId()}); return false; }else if(!req.getRequestType().equals(resp.getRequestType())){ theLogger.log(Level.INFO, "Request Type ({0}) does not match Response Type ({1}).", new Object[]{req.getRequestType(), resp.getRequestType()}); return false; /*}else if(!req.getSourceId().equals(resp.getDestinationId())){ return false; }else if(!req.getDestinationId().equals(resp.getSourceId())){ return false; */}else if(req.getTimestampMillisecUTC() != resp.getRequestTimestampMillisecUTC()){ theLogger.log(Level.INFO, "Request Timestamp ({0}) does not match Response Request Timestamp ({1}).", new Object[]{req.getTimestampMillisecUTC(), resp.getRequestTimestampMillisecUTC()}); return false; } return true; } }
/** * Retrieves the Joint specified in the RobotRequest. * @param req RobotRequest specifying a Joint * @return Joint specified in the RobotRequest */ protected Joint getRequestedJoint(RobotRequest req){ Integer jIdInt = req.getRequestIndex(); if(jIdInt == null){ throw new NullPointerException(); } Joint.Id jId = new Joint.Id(jIdInt); Robot.Id rId = req.getRobotId(); JointId jointId = new Robot.JointId(rId, jId); Joint j = getRobot().getJoint(jointId); if(j == null){ throw new NullPointerException(); } return j; }
@Override public void handleEvent(RobotRequest event) { String reqType = event.getRequestType(); if(reqType == null){ theLogger.info("Received RobotRequest with null RequestType.");