Inheritance: MonoBehaviour
	public ElectrocuteAction(RobotController controller, List<Goal> goals, Label target)
		: base(controller, goals, target.labelHandle) {
		this.name = "electrocute";
		this.target = target;
		requiredComponents = new System.Type[] { };

	}
Example #2
0
 public PursueAction(RobotController controller, List<Goal> goals, Label target)
     : base(controller, goals, target.gameObject)
 {
     this.target = target;
     this.name = "pursue";
     requiredComponents = new System.Type[] {typeof(HoverJet)};
 }
 public RechargeAction(EndeavourFactory factory, RobotController controller, List<Goal> goals, Dictionary<TagEnum, Tag> tagMap, Battery battery)
     : base(factory, controller, goals, tagMap)
 {
     powerStation = getTagOfType<Tag>(TagEnum.PowerStation);
     this.name = "recharge";
     this.battery = battery;
 }
        static void Main(string[] args)
        {
            RobotController Robot = new RobotController();
            Robot.Connect("192.168.1.1");
            Console.WriteLine("Robot connecté ... ");

            double cosTeta = 0.649352561565284; //teta=49.50...
            double sinTeta = 0.760487508634168; // sinTeta = System.Math.Cos(45);

            while(true)
            {
                double rX =  Robot.GetCurrentPosition().X * cosTeta - Robot.GetCurrentPosition().Y * sinTeta;
                double rY =  Robot.GetCurrentPosition().X * sinTeta + Robot.GetCurrentPosition().Y * cosTeta;

                //while((30 <= rX <= -30)&&(30 <= rY <= -20)&&(Robot.GetCurrentPosition().Z < 5))
                //if ((-300 >= rX) && (rX >= 300) && (-200 >= rY) && (rY >= 300) && (Robot.GetCurrentPosition().Z <= 50))
                if ((-200 <= rX) && (rX <= 800) && (130 <= rY) && (rY <= 790) && (Robot.GetCurrentPosition().Z >= 50))
                {
                   //move robot
                    Console.WriteLine("Robot reste dans la zone de securité YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY");
                    Console.WriteLine("Robot position : x:" + Robot.GetCurrentPosition().X + "; y:" + Robot.GetCurrentPosition().Y + "; z: " + Robot.GetCurrentPosition().Z);
                    Console.WriteLine("   Rotation de X : " + rX +"; Y : " + rY);
                }
                else
                {
                    //robot s'arrete
                    Console.WriteLine("!!! Robot a sorti de la zone de securité !!!!!!!!!!!!!!!!!!!!!!!");
                    Console.WriteLine("Robot position : x:" + Robot.GetCurrentPosition().X + "; y:" + Robot.GetCurrentPosition().Y + "; z: " + Robot.GetCurrentPosition().Z);
                    Console.WriteLine("   Rotation de X : " + rX + "; Y : " + rY);
                }
                System.Threading.Thread.Sleep(2000);
            }
        }
Example #5
0
 public HoldAction(RobotController controller, Label target, GameObject source)
     : base(controller, new List<Goal>{new Goal(GoalEnum.Offense, 3), new Goal(GoalEnum.Protection, 3)}, source)
 {
     this.target = target;
     this.name = "grab";
     requiredComponents = new System.Type[] {typeof(RobotArms)};
 }
Example #6
0
 public InvestigateAction(RobotController controller, List<Goal> goals, LabelHandle parent)
     : base(controller, goals, parent)
 {
     creationTime = System.DateTime.Now;
     this.name = "investigate";
     requiredComponents = new System.Type[] { typeof(HoverJet) };
 }
 public void Turn(RobotController other)
 {
     /*direction = rc.dire >= 3 ? 0 : rc.dire + 1;
         rc.Turn(direction);
         rc.Zoning();*/
         GetComponent<Turn>().RunPanel(other.gameObject);
 }
Example #8
0
	public override Endeavour constructEndeavour(RobotController controller) {
		if(parent == null) {
			return null;
		}

		return new GuardAction(controller, goals, parent);
	}
 protected void applyPlayerKnowledge(RobotController controller)
 {
     Player[] players = FindObjectsOfType<Player>();
     foreach(Player player in players) {
         controller.addKnownLocation(player.GetComponent<Label>());
     }
 }
 public Endeavour constructEndeavour(RobotController controller, List<Tag> tags)
 {
     Dictionary<TagEnum, Tag> tagMap = new Dictionary<TagEnum, Tag>();
     foreach (Tag tag in tags) {
         tagMap.Add(tag.type, tag);
     }
     return createEndeavour(controller, tagMap);
 }
Example #11
0
 public RechargeAction(RobotController controller, List<Goal> goals, Label target, Battery battery)
     : base(controller, goals, target.labelHandle)
 {
     powerStation = target;
     this.name = "recharge";
     requiredComponents = new System.Type[] { typeof(HoverJet) };
     this.battery = battery;
 }
Example #12
0
 public int getConcurrentExecutions(RobotController executor, System.Type endeavourType)
 {
     HashSet<RobotController> endeavourExecutors = getExecutors(endeavourType);
     if (endeavourExecutors.Contains(executor)) {
         return endeavourExecutors.Count - 1;
     }
     return endeavourExecutors.Count;
 }
 public void Recover(RobotController other)
 {
     other.hp += 10;
     if(other.mhpCurrent< other.hp)
     {
         other.hp = other.mhpCurrent;
     }
 }
 public InvestigateAction(EndeavourFactory factory, RobotController controller, List<Goal> goals, Dictionary<TagEnum, Tag> tags)
     : base(factory, controller, goals, tags)
 {
     //creationTime = System.DateTime.Now;
     creationTime = Time.time;
     this.name = "investigate";
     sound = getTagOfType<Tag>(TagEnum.Sound);
 }
Example #15
0
	public override Endeavour constructEndeavour (RobotController controller) {
		if (parent == null) {
			return null;
		}
		//Goal[] goals = new Goal[2];
		//goals [0] = new Goal ("protection", 3);
		//goals [1] = new Goal ("offense", 3);
		return new PursueAction(controller, goals, parent);
	}
Example #16
0
    public override Endeavour constructEndeavour(RobotController controller) {
		Battery battery = controller.GetComponentInChildren<Battery>();
		if (parent == null || battery == null) {
            return null;
        }
		RechargeAction action = new RechargeAction(controller, goals, parent, battery);
		action.rechargePoint = rechargePoint;
        return action;
    }
 public void addListener(RobotController listener)
 {
     RobotAntenna antenna = listener.getRobotComponent<RobotAntenna>();
     if (antenna != null) {
         forceAddListener(listener);
     } else {
         Debug.LogWarning("Cannot add robot without antenna to CRC: " + listener.name);
     }
 }
 public RobotController getController()
 {
     if (roboController == null) {
         roboController = GetComponentInParent<RobotController>();
         if (roboController == null)
             Debug.LogWarning("Robot component '" + name + "' is not attached to a robot controller!");
     }
     return roboController;
 }
Example #19
0
	public override Endeavour constructEndeavour (RobotController controller) {
		if (parent == null || getPoints() == null || getPoints().Count == 0) {
			if(getPoints().Count == 0) {
				Debug.LogWarning("Patrol route '"+parent.name+"' has no route points");
			}
			return null;
		}
		return new PatrolAction(controller, goals, getPointHandles(), parent);
	}
    void Start()
    {
        this.shooterMode = this.GetComponent<KaneShooterController> ();
        this.robotMode = this.GetComponent<RobotController> ();

        this.robotMode.enabled = this.starts [0];
        this.shooterMode.enabled = this.starts [1];

        this.shooterMode.start ();
    }
 protected override Endeavour createEndeavour(RobotController controller, Dictionary<TagEnum, Tag> tags)
 {
     Battery battery = controller.GetComponentInChildren<Battery>();
     if (battery == null) {
         return null;
     }
     RechargeAction action = new RechargeAction(this, controller, goals, tags, battery);
     action.rechargePoint = rechargePoint;
     return action;
 }
Example #22
0
	public override Endeavour constructEndeavour (RobotController controller) {
		if (parent == null) {
			return null;
		}
		//Goal[] goals = new Goal[2];
		//goals[0] = new Goal ("protection", 5);
		//goals[1] = new Goal ("offense", 5);
		//Debug.Log ("get drop");
		return new DropKickAction(controller, goals, parent.labelHandle);
	}
Example #23
0
 public virtual List<Endeavour> getAvailableEndeavours(RobotController controller)
 {
     List<Endeavour> availableEndeavours = new List<Endeavour> ();
     foreach (EndeavourFactory endeavour in endeavours) {
         Endeavour newEndeavour = endeavour.constructEndeavour(controller);
         if(newEndeavour != null) {
             availableEndeavours.Add(newEndeavour);
         }
     }
     return availableEndeavours;
 }
    public PatrolAction(EndeavourFactory factory, RobotController controller, List<Goal> goals, Dictionary<TagEnum, Tag> tagMap)
        : base(factory, controller, goals, tagMap)
    {
        this.name = "patrol";

        PatrolTag patrolTag = getTagOfType<PatrolTag>(TagEnum.PatrolRoute);
        if (patrolTag.getPoints() == null || patrolTag.getPoints().Count == 0) {
            Debug.LogWarning("Patrol route '" + patrolTag.getLabelHandle().label.name + "' has no route points");
        }
        routePoints = patrolTag.getPointHandles();
    }
	// Use this for initialization
	void Awake () {
		roboController = GetComponentInParent<RobotController> ();
        if (roboController == null) {
            Debug.LogWarning("Robot component '" + name + "' is not attached to a robot controller!");
        } else {
            powerSource = roboController.GetComponentInChildren<AbstractPowerSource>();

        }
        if (roboController == null) {
            Debug.LogWarning("Robot component '" + name + "' has no power source!");
        }

    }
Example #26
0
	public PatrolAction(RobotController controller, List<Goal> goals, List<LabelHandle> route, Label target)
		: base(controller, goals, target.labelHandle) {
		//this.route = route;
		this.name = "patrol";
		requiredComponents = new System.Type[] {typeof(HoverJet)};
		//this.points = route;
		//routePoints = new List<Label> ();
		routePoints = route;
		/*foreach (GameObject point in points) {
			Label label = point.GetComponent<Label>();
			if (label != null) {
				routePoints.Add(label);
			}
		}*/
	}
 // Constructeur permettant de ce connecter au robot
 public Class_Kuka_Manager()
 {
     if (debug)
     {
         robot = new RobotController();
         try
         {
             robot.Connect("192.168.1.1");
             Console.WriteLine("coonected");
         }
         catch (IOException e)
         {
             Console.WriteLine(e);
         }
     }
 }
Example #28
0
        static void Main(string[] args)
        {
            RobotController Robot = new RobotController();
            Robot.Connect("192.168.1.1");
            Console.WriteLine("Robot connecté ... ");
            Console.WriteLine("Robot position : x:" + Robot.GetCurrentPosition().X + "; y:" + Robot.GetCurrentPosition().Y + "; z: " + Robot.GetCurrentPosition().Z);

            List<CartesianPosition> Trajectoire = new List<CartesianPosition>();
            for (int i = 1; i <= 100; i++)
            {

                Trajectoire.Add(new CartesianPosition
                {
                    X = i + Robot.GetCurrentPosition().X,
                    Y = i + Robot.GetCurrentPosition().Y,
                    Z = i + Robot.GetCurrentPosition().Z,
                    A = 0 + Robot.GetCurrentPosition().A,
                    B = 0 + Robot.GetCurrentPosition().B,
                    C = 0 + Robot.GetCurrentPosition().C

                });
            }
            //Robot.PlayTrajectory(Trajectoire);

            Robot.StartRelativeMovement();
            CartesianPosition Test = new CartesianPosition
            {

                X = -1,
                Y = 0,
                Z = 0,
                A = 0,
                B = 0,
                C = 0
            };

            Robot.SetRelativeMovement(Test);
            System.Threading.Thread.Sleep(2000);
            Robot.StopRelativeMovement();

            Device Mouse = new Device();
        }
Example #29
0
	void Update() {
		if(isScanning()) {
			currentScanTime += Time.deltaTime;
		}

		if(currentScanTime > scanTime) {
			currentScanTime = 0;
			stopScan();
			if(currentController == null) {
				currentController = GetComponentInParent<RobotController>();
			}
			currentController.enqueueMessage(new RobotMessage(RobotMessage.MessageType.ACTION, "target scanned", null, new Vector3(), null));
		}


		if(active) {
			if(!soundEmitter.isPlaying) {
			//soundEmitter.clip = scanSound;
				soundEmitter.PlayOneShot(scanSound);
			}
			float movementRate = 4f*movementRange/(scanTime);
			drawLines();
			if(movingUp) {
				upness += Time.deltaTime * movementRate;
				if(upness > movementRange) {
					movingUp = false;
				}
			} else {
				upness -= Time.deltaTime * movementRate;
				if(Mathf.Abs(upness) > movementRate) {
					movingUp = true;
				}
			}
		} else {
			if(soundEmitter.isPlaying) {
				soundEmitter.Stop();
			}
			clearLines();
		}
	}
 /// <summary>
 /// あらかじめ指定されたパネル効果を実行
 /// </summary>
 public void Run(RobotController other)
 {
     if (mikata == other.Mikata && !process)
     {
         switch (targetNo)
         {
             case 0://移動
                 Turn(other);
                 break;
             case 1:
                 Destruct(other);
                 break;
             case 2:
                 Stop(other);
                 break;
             case 3:
                 Recover(other);
                 break;
         }
         process = true;
         GetComponent<Animator>().SetTrigger("PanelEffect");
     }
 }