Examples of BehaviourOutput


Examples of fr.utbm.gi.vi51.pw.behavior.BehaviourOutput

    Point2d position = new Point2d(getX(), getY());
    Vector2d orientation = getDirection();
    double linearSpeed = getCurrentLinearSpeed();
    double angularSpeed = getCurrentAngularSpeed();
   
    BehaviourOutput output = null;

    List<Perception> perceptions = getPerceivedObjects();

    if (this.seekBehaviour!=null && !perceptions.isEmpty()) {

      Perception percept = perceptions.get(0);

      if (percept.getPerceivedObject() instanceof MouseTarget) {
        Point2d target = new Point2d(percept.getPerceivedObject().getPosition());

        // run the seek behaviour
        output = this.seekBehaviour.runSeek(position, linearSpeed, getMaxLinear(), target);
      }
      else {
        // run the wander behaviour
        output = this.wanderBehaviour.runWander(position, orientation, linearSpeed, getMaxLinear(), angularSpeed, getMaxAngular());
      }
    }
    else {
      // run the wander behaviour
      output = this.wanderBehaviour.runWander(position, orientation, linearSpeed, getMaxLinear(), angularSpeed, getMaxAngular());
    }

    // Send the behaviour output to the environment
    if (output!=null) {
      if (this.isSteering)
        influenceSteering(output.getLinear(),output.getAngular());
      else
        influenceKinematic(output.getLinear(),output.getAngular());
    }
   
    return StatusFactory.ok(this);
  }
View Full Code Here

Examples of fr.utbm.gi.vi51.pw.behavior.BehaviourOutput

    Point2d position = new Point2d(getX(), getY());
    Vector2d orientation = getDirection();
    double linearSpeed = getCurrentLinearSpeed();
    double angularSpeed = getCurrentAngularSpeed();
   
    BehaviourOutput output = null;

    List<Perception> perceptions = getPerceivedObjects();

    if (this.seekBehaviour!=null && !perceptions.isEmpty())
    {
      Perception percept = perceptions.get(0);
    }

    //Take a decision
    currentAction.setAction(Action.BuildABridge);
   

    //output = this.wanderBehaviour.runWander(position, orientation, linearSpeed, getMaxLinear(), angularSpeed, getMaxAngular());
    output = new SteeringBehaviourOutput();
    output.setLinear(1, 0);
    output.setAngular(0);

    // Send the behaviour output to the environment
    if (output!=null) {
      if (this.isSteering)
        influenceSteering(output.getLinear(),output.getAngular());
      else
        influenceKinematic(output.getLinear(),output.getAngular());
    }
   
    return StatusFactory.ok(this);
  }
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.