Examples of Sensor


Examples of components.features.sensor.Sensor

  }


  public void run()
  {
    Sensor        sensor;
    Integer        sensorValue;
    RobotState      robotState;
    double[]      pos;
    double        course;
    boolean        finished1, finished2, finished3;
    RecognizedItems    sceneItems;
    int          i;
   
   
    Logger.info( "El canal de comunicaciones comienza su ejecuci�n." );

   
    int width  = ((ImageBasedGPS) Simulation.getCurrent().getGps()).getImageCollector().getImageResolution().width;
    int height  = ((ImageBasedGPS) Simulation.getCurrent().getGps()).getImageCollector().getImageResolution().height;
   
    if ( width <= 0 width = Defines.DEFAULT_IMAGE_RESOLUTION[0];
    if ( height <= 0 height = Defines.DEFAULT_IMAGE_RESOLUTION[1];
   

    while ( ! isClosed() )
    {
     
      getCommChannelSemaphore().WAIT();

      //////////////////////////////////////////
      //                    //
      //     Se analiza el SENSOR FRONTAL    //
      //                    //
      //////////////////////////////////////////

      sensor = (ProximitySensor)features.featuresHash.get( FRONT_SENSOR_NAME );
      if ( sensor != null )
      {         
        // TODO ELIMINAR HARDCODEO DE AREA Y MASA
        if ( frontCam.isCollision(RobotCamColorTrack.TRACK_RAIL, 4000, 50) )
          // El sensor est� detectando algo
          sensor.setValue( new Boolean(true) );
        else
          sensor.setValue( new Boolean(false) );
      }
      else
      {
        // TODO: ver c�mo manejar la situaci�n en que no se
        // encuentra el feature en el hash.
        Logger.error("No se pudo acceder al sensor.");
      }

      /* EL CODIGO DE SENSORES IZQ Y DER ESTA POR COMPATIBILIDAD HACIA ATR�S, NO HACE NADA*/
     
      sensor = (ProximitySensor)features.featuresHash.get( LEFT_SENSOR_NAME );
      if ( sensor != null ) sensor.setValue( new Boolean(false) );
      else Logger.error("No se pudo acceder al sensor.");
     
      sensor = (ProximitySensor)features.featuresHash.get( RIGHT_SENSOR_NAME );
      if ( sensor != null ) sensor.setValue( new Boolean(false) );
      else Logger.error("No se pudo acceder al sensor.");

      //////////////////////////////////////////
      //    Se analiza el SENSOR DE COLOR    //
      //////////////////////////////////////////

      sensor = (ColorSensor)features.featuresHash.get( COLOR_SENSOR_NAME );
     
      // TODO hacer el metodo get current color!!
      sensor.setValue( frontCam.getCurrentColor() );
     
      getCommChannelSemaphore().SIGNAL();
     
      // Duerme durante un intervalo
      try
View Full Code Here

Examples of components.features.sensor.Sensor

  }


  public void run()
  {
    Sensor  sensor;
   
    Logger.info( "El canal de comunicaciones comienza su ejecuci�n." );

   
    int width  = ((ImageBasedGPS) Simulation.getCurrent().getGps()).getImageCollector().getImageResolution().width;
    int height  = ((ImageBasedGPS) Simulation.getCurrent().getGps()).getImageCollector().getImageResolution().height;
   
    if ( width <= 0 width = Defines.DEFAULT_IMAGE_RESOLUTION[0];
    if ( height <= 0 height = Defines.DEFAULT_IMAGE_RESOLUTION[1];
   
    int samples=1;
   
    int direccion = RobotCamColorTrack.NO_MOVE;
    int antmove = RobotCamColorTrack.MOVER_ADELANTE;
       
   
    while ( ! isClosed() )
    { 
      Simulation.getCurrent().getSerialTurn().WAIT();
      getCommChannelSemaphore().WAIT();
     
      try{
       
        try {
          Thread.sleep(2*SerialCommunicationChannel.MOVE_TIME);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
       
     
      long start = System.currentTimeMillis();
      ///// SE CARGA UNA IMAGEN ////     
      frontCam.grabFrame();     
     
      ///// SE OBTIENE INFO DE RIEL Y LUGARES ////
      ArrayList<TrackingInformation> tiRails = frontCam.getTrackingInformation(RobotCamColorTrack.TrackType.RAIL_TRACK,samples);
      ArrayList<TrackingInformation> tiColors = frontCam.getTrackingInformation(RobotCamColorTrack.TrackType.COLOR_TRACK,samples);
      long end = System.currentTimeMillis();
     
      //log.debug("CAM TIME="+((float)(end-start))/1000f);
     
      /// SE DETERMINA EL RIEL Y EL LUGAR ////
      TrackingInformation currentRail = frontCam.calculateBestRailColor(tiRails);
      VectorValues currentVector = frontCam.calculateBestVector(tiColors);
     
      int railMass = currentRail.getColorMass();
      direccion = frontCam.getTurningDirection(currentRail.getMeanX(),railMass,15,antmove);     
      antmove=direccion;
     
      log.debug("===========================");
      log.debug(currentRail.getDescription());
      log.debug(currentRail);

      log.debug("===========================");
      log.debug(currentVector.getDescription().toUpperCase());
      log.debug(currentVector.toString());
     
     
      ///// Se graba la recomendacion de nuestros algoritmos acerca de qu� hay que hacer /////
      sensor = (ProximitySensor)features.featuresHash.get( MOVE_HINT );
      if ( sensor != null )
      {       
        sensor.setValue( new Integer(direccion) );
      }
      else
      {
        Logger.error("Oops! No anduvo..");
      }

      ///// Se graba lo que dicen los algoritmos acerca de si llegamos a un lugar /////
      sensor = (ProximitySensor)features.featuresHash.get( IN_PLACE );
      if ( sensor != null )
      {       
        sensor.setValue( frontCam.isInPlace(currentVector) );
      }
      else
      {
        Logger.error("Oops! No anduvo..");
      }
           
      ///// Se analiza el SENSOR FRONTAL   /////
      sensor = (ProximitySensor)features.featuresHash.get( FRONT_SENSOR_NAME );
      if ( sensor != null )
      {       
        if ( direccion != RobotCamColorTrack.MOVER_ADELANTE  )
          sensor.setValue( new Boolean(true) );
        else
          sensor.setValue( new Boolean(false) );
      }
      else
      {
        // TODO: ver c�mo manejar la situaci�n en que no se
        // encuentra el feature en el hash.
        Logger.error("No se pudo acceder al sensor.");
      }

      //////  Se analiza el SENSOR DE COLOR  /////
      sensor = (ColorSensor)features.featuresHash.get( COLOR_SENSOR_NAME );     
      sensor.setValue( currentVector );
      }catch(Exception e){
        e.printStackTrace();
      }
     
      getCommChannelSemaphore().SIGNAL();
View Full Code Here

Examples of fr.soleil.lib.flyscan.model.parsing.configuration.fsobject.actor.Sensor

        assertEquals(90.0, tTrajectory.getPoints().get(8));

        assertEquals(100.0, tTrajectory.getPoints().get(9));

        Sensor sensor = null;

        for (Actor a : actorSection.getActors()) {
            if ((a instanceof Sensor) && (a.getName().equalsIgnoreCase("sensor_a"))) {
                sensor = (Sensor) a;
            }
        }

        assertNotNull(sensor);

        Entry measurementsEntry = null;

        for (Entry e : sensor.getEntries()) {
            if (e.getKey().equalsIgnoreCase("measurements")) {
                measurementsEntry = e;
            }
        }
View Full Code Here

Examples of fr.soleil.lib.flyscan.model.parsing.configuration.fsobject.actor.Sensor

                            }
//                        else if (name.equals(ParsingUtil.CUSTOM_ACTUATOR)) {
//                            currentObject = new CustomActuator(currentSection);
//                        }
                            else if (name.equals(ParsingUtil.SENSOR)) {
                                currentObject = new Sensor(currentSection);
                            } else if (name.equals(ParsingUtil.TIMEBASE)) {
                                currentObject = new TimeBase(currentSection);
                            } else if (name.equals(ParsingUtil.HOOK)) {
                                currentObject = new Hook(currentSection);
                            } else if (name.equals(ParsingUtil.MONITOR)) {
View Full Code Here

Examples of javax.media.j3d.Sensor

/* 630 */       this.listsDirty = false;
/*     */     }
/*     */
/* 634 */     for (int k = 0; k < this.bindings.length; k++) {
/* 635 */       SensorBinding sb = this.bindings[k];
/* 636 */       Sensor s = sb.sensor;
/* 637 */       Transform3D read = sb.read;
/* 638 */       int[] buttons = sb.buttons;
/* 639 */       int dragButton = 0;
/* 640 */       boolean callReadListeners = true;
/* 641 */       boolean callDraggedListener = false;
/*     */
/* 644 */       s.getRead(read);
/* 645 */       s.lastButtons(buttons);
/*     */
/* 648 */       for (int j = 0; j < sb.buttonBindings.length; j++) {
/* 649 */         SensorButtonBinding sbb = sb.buttonBindings[j];
/* 650 */         for (int i = 0; i < buttons.length; i++) {
/* 651 */           if (sbb.listeners[i] != null)
View Full Code Here

Examples of megamek.common.Sensor

        } // End public void displayMech( Entity )

        private void refreshSensorChoices(Entity en) {
            chSensors.removeAll();
            for (int i = 0; i < en.getSensors().size(); i++) {
                Sensor sensor = en.getSensors().elementAt(i);
                String condition = "";
                if (sensor.isBAP() && !en.hasBAP(false)) {
                    condition = " (Disabled)";
                }
                chSensors.add(Sensor.getSensorName(sensor.getType())
                        + condition);
                if (sensor.getType() == en.getNextSensor().getType()) {
                    chSensors.select(i);
                }
            }
        }
View Full Code Here

Examples of megamek.common.Sensor

        private void refreshSensorChoices(Entity en) {
            chSensors.removeItemListener(this);
            chSensors.removeAllItems();
            for (int i = 0; i < en.getSensors().size(); i++) {
                Sensor sensor = en.getSensors().elementAt(i);
                String condition = "";
                if (sensor.isBAP() && !en.hasBAP(false)) {
                    condition = " (Disabled)";
                }
                chSensors.addItem(Sensor.getSensorName(sensor.getType())
                        + condition);
                if (sensor.getType() == en.getNextSensor().getType()) {
                    chSensors.setSelectedIndex(i);
                }
            }
            chSensors.addItemListener(this);
        }
View Full Code Here

Examples of org.apache.kafka.common.metrics.Sensor

        public void maybeRegisterTopicMetrics(String topic) {
            // if one sensor of the metrics has been registered for the topic,
            // then all other sensors should have been registered; and vice versa
            String topicRecordsCountName = "topic." + topic + ".records-per-batch";
            Sensor topicRecordCount = this.metrics.getSensor(topicRecordsCountName);
            if (topicRecordCount == null) {
                topicRecordCount = this.metrics.sensor(topicRecordsCountName);
                topicRecordCount.add("topic." + topic + ".record-send-rate", new Rate());

                String topicByteRateName = "topic." + topic + ".bytes";
                Sensor topicByteRate = this.metrics.sensor(topicByteRateName);
                topicByteRate.add("topic." + topic + ".byte-rate", new Rate());

                String topicCompressionRateName = "topic." + topic + ".compression-rate";
                Sensor topicCompressionRate = this.metrics.sensor(topicCompressionRateName);
                topicCompressionRate.add("topic." + topic + ".compression-rate", new Avg());

                String topicRetryName = "topic." + topic + ".record-retries";
                Sensor topicRetrySensor = this.metrics.sensor(topicRetryName);
                topicRetrySensor.add("topic." + topic + ".record-retry-rate", new Rate());

                String topicErrorName = "topic." + topic + ".record-errors";
                Sensor topicErrorSensor = this.metrics.sensor(topicErrorName);
                topicErrorSensor.add("topic." + topic + ".record-error-rate", new Rate());
            }
        }
View Full Code Here

Examples of org.drools.Sensor

        final List sensors = new ArrayList();

        workingMemory.setGlobal( "sensors",
                                 sensors );

        final Sensor sensor1 = new Sensor( 100,
                                           150 );
        workingMemory.insert( sensor1 );
        workingMemory.fireAllRules();
        assertEquals( 0,
                      sensors.size() );

        final Sensor sensor2 = new Sensor( 200,
                                           150 );
        workingMemory.insert( sensor2 );
        workingMemory.fireAllRules();
        assertEquals( 3,
                      sensors.size() );
View Full Code Here

Examples of org.drools.Sensor

        final List events = new ArrayList();

        workingMemory.setGlobal( "events",
                                 events );

        final Sensor sensor = new Sensor( 80,
                                          80 );
        final FactHandle handle = workingMemory.insert( sensor );

        // everything should be normal
        workingMemory.fireAllRules();

        final List list = IteratorToList.convert( workingMemory.iterateObjects() );

        assertEquals( "Only sensor is there",
                      1,
                      list.size() );
        assertEquals( "Only one event",
                      1,
                      events.size() );

        // problems should be detected
        sensor.setPressure( 200 );
        sensor.setTemperature( 200 );
        workingMemory.update( handle,
                              sensor );

        workingMemory.fireAllRules();
        //        logger.writeToDisk();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.