Пример #1
0
        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);
            }
        }
Пример #2
0
        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;
 }
Пример #4
0
 public TurnGunNode(BlackBoard bb)
 {
     this.bb = bb;
 }
 public CircleAroundNode(BlackBoard bb)
 {
     this.bb = bb;
 }
Пример #6
0
 public TrackNode(BlackBoard bb, double scanRadians, double trackArea)
 {
     this.bb          = bb;
     this.scanRadians = scanRadians;
     this.trackArea   = trackArea;
 }
Пример #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;
 }
Пример #9
0
 public FindPattern(BlackBoard bb)
 {
     this.bb = bb;
 }
Пример #10
0
 public MoveNode(BlackBoard bb, double distance)
 {
     this.bb       = bb;
     this.distance = distance;
 }
Пример #11
0
 public InverterNode(BlackBoard bb, BaseNode child)
 {
     this.bb        = bb;
     this.childNode = child;
 }
Пример #12
0
 public SequenceNode(BlackBoard bb, params BaseNode[] _inputNodes)
 {
     this.inputNodes = _inputNodes;
     this.bb         = bb;
 }
Пример #13
0
 public QSNode(BlackBoard bb)
 {
     this.bb = bb;
 }
Пример #14
0
 public AnitGravMoveNode(BlackBoard bb, double distance)
 {
     this.bb       = bb;
     this.distance = distance;
     //this.gravpoints = inputPoints;
 }
Пример #15
0
 public FireNode(BlackBoard bb, double power)
 {
     this.bb    = bb;
     this.power = power;
 }
Пример #16
0
 public SetPowerNode(BlackBoard bb)
 {
     this.bb = bb;
 }
Пример #17
0
 public ScanNode(BlackBoard bb, double scanRadians)
 {
     this.bb          = bb;
     this.scanRadians = scanRadians;
 }