コード例 #1
0
 /**
  * Request/reply: Get/set sensor field of view. <br>
  * <br>
  * The field of view of the fiducial device can be set using the PLAYER_FIDUCIAL_REQ_GET_FOV
  * request (response will be null), and queried using a null PLAYER_FIDUCIAL_REQ_GET_FOV request.
  * <br>
  * <br>
  * See the player_fiducial_fov structure from player.h
  *
  * @param pff a PlayerFiducialFov structure holding the required data
  */
 public void setFov(PlayerFiducialFov pff) {
   try {
     sendHeader(PLAYER_MSGTYPE_REQ, PLAYER_FIDUCIAL_REQ_SET_FOV, 12);
     XdrBufferEncodingStream xdr = new XdrBufferEncodingStream(12);
     xdr.beginEncoding(null, 0);
     xdr.xdrEncodeFloat(pff.getMin_range());
     xdr.xdrEncodeFloat(pff.getMax_range());
     xdr.xdrEncodeFloat(pff.getView_angle());
     xdr.endEncoding();
     os.write(xdr.getXdrData(), 0, xdr.getXdrLength());
     xdr.close();
     os.flush();
   } catch (IOException e) {
     throw new PlayerException(
         "[Fiducial] : Couldn't request PLAYER_FIDUCIAL_REQ_SET_FOV: " + e.toString(), e);
   } catch (OncRpcException e) {
     throw new PlayerException(
         "[Fiducial] : Error while XDR-encoding SET_FOV request: " + e.toString(), e);
   }
 }
コード例 #2
0
 /**
  * Request/reply: Get/set fiducial ID. <br>
  * <br>
  * Some fiducial finder devices display their own fiducial. Send a null PLAYER_FIDUCIAL_REQ_GET_ID
  * request to get the identifier displayed by the fiducial. <br>
  * <br>
  * Some devices can dynamically change the identifier they display. They can use the
  * PLAYER_FIDUCIAL_REQ_SET_ID request to allow a client to set the currently displayed value. Make
  * the request with the player_fiducial_id_t structure. The device replies with the same structure
  * with the id field set to the value it actually used. You should check this value, as the device
  * may not be able to display the value you requested. <br>
  * <br>
  * Currently supported by the stg_fiducial driver. <br>
  * <br>
  * See the player_fiducial_id structure from player.h
  *
  * @param id the fiducial ID to be displayed
  */
 public void setFiducialVal(int id) {
   try {
     sendHeader(PLAYER_MSGTYPE_REQ, PLAYER_FIDUCIAL_REQ_SET_ID, 4);
     XdrBufferEncodingStream xdr = new XdrBufferEncodingStream(4);
     xdr.beginEncoding(null, 0);
     xdr.xdrEncodeInt(id);
     xdr.endEncoding();
     os.write(xdr.getXdrData(), 0, xdr.getXdrLength());
     xdr.close();
     os.flush();
   } catch (IOException e) {
     throw new PlayerException(
         "[Fiducial] : Couldn't request PLAYER_FIDUCIAL_REQ_SET_ID: " + e.toString(), e);
   } catch (OncRpcException e) {
     throw new PlayerException(
         "[Fiducial] : Error while XDR-encoding SET_ID request: " + e.toString(), e);
   }
 }