public override BehaviourTreeStatus Tick()
        {
            BlackBoard blackBoard = this.bb;
            double     rotation   = 0;
            double     accuracy   = 5;

            rotation = GetAngleOfGunHeading();
            double distance = blackBoard.ScannendEvent.Distance;

            accuracy = 180 / (distance * 0.1f);
            double absoluteBearing = this.bb.Robot.Heading + this.bb.ScannendEvent.Bearing;

            this.bb.Robot.TurnGunRight(Utils.ToDegrees(Utils.NormalRelativeAngle(Utils.ToRadians(absoluteBearing - this.bb.Robot.GunHeading))));
            //blackBoard.Robot.TurnGunRight(rotation);

            return(BehaviourTreeStatus.Success);


            if (Math.Abs(rotation) < accuracy)
            {
                return(BehaviourTreeStatus.Success);
            }
            else
            {
                return(BehaviourTreeStatus.Running);
            }
        }
        public double GetAngleOfGunHeading()
        {
            BlackBoard blackBoard = this.bb;

            if (this.bb.ScannendEvent == null)
            {
                return(0);
            }

            double angle = blackBoard.ScannendEvent.Bearing -
                           (blackBoard.Robot.GunHeading - blackBoard.Robot.Heading);

            if (angle < -180)
            {
                angle += 360;
            }
            return(angle);
        }
 public SelectorNode(BlackBoard bb, params BaseNode[] _inputNodes)
 {
     this.bb = bb;
     this.inputNodes = _inputNodes;
 }
 public TurnGunNode(BlackBoard bb)
 {
     this.bb = bb;
 }
 public CircleAroundNode(BlackBoard bb)
 {
     this.bb = bb;
 }
 public TrackNode(BlackBoard bb, double scanRadians, double trackArea)
 {
     this.bb          = bb;
     this.scanRadians = scanRadians;
     this.trackArea   = trackArea;
 }
Beispiel #7
0
 public void OnInitialize(BlackBoard bb)
 {
     throw new NotImplementedException();
 }
 public ConditionNode(BlackBoard blackBoard, Func <bool> condition, params BaseNode[] input)
 {
     this.bb         = blackBoard;
     this.condition  = condition;
     this.inputNodes = input;
 }
Beispiel #9
0
 public FindPattern(BlackBoard bb)
 {
     this.bb = bb;
 }
Beispiel #10
0
 public MoveNode(BlackBoard bb, double distance)
 {
     this.bb       = bb;
     this.distance = distance;
 }
Beispiel #11
0
 public InverterNode(BlackBoard bb, BaseNode child)
 {
     this.bb        = bb;
     this.childNode = child;
 }
 public SequenceNode(BlackBoard bb, params BaseNode[] _inputNodes)
 {
     this.inputNodes = _inputNodes;
     this.bb         = bb;
 }
 public QSNode(BlackBoard bb)
 {
     this.bb = bb;
 }
Beispiel #14
0
 public AnitGravMoveNode(BlackBoard bb, double distance)
 {
     this.bb       = bb;
     this.distance = distance;
     //this.gravpoints = inputPoints;
 }
 public FireNode(BlackBoard bb, double power)
 {
     this.bb    = bb;
     this.power = power;
 }
 public SetPowerNode(BlackBoard bb)
 {
     this.bb = bb;
 }
Beispiel #17
0
 public ScanNode(BlackBoard bb, double scanRadians)
 {
     this.bb          = bb;
     this.scanRadians = scanRadians;
 }