Example #1
0
 // Use this for initialization
 void Start()
 {
     goForward   = false;
     goRotation  = false;
     targetFound = false;
     tempReached = false;
     rPL         = GetComponent <RobotPlanning>();
 }
Example #2
0
    // Use this for initialization
    void Start()
    {
        isTheChosenOne    = true;
        filePathPosResNum = Application.dataPath + pathPosNum;
        if (File.Exists(filePathPosResNum))
        {
            fileContent = File.ReadAllText(filePathPosResNum);
            trajectory  = JsonUtility.FromJson <JsonRobotData>(fileContent);
            Debug.Log(trajectory.time);
            filePos.Close();
            if (trajectory.time == 0.0f)
            {
                CheckIteration();
            }
        }

        alpha = startingAlpha;
        beta  = startingBeta;

        if (alpha + beta < 1f)
        {
            CheckIteration();
        }

        timer       = Timer();
        robot       = GameObject.Find("Robot");
        robotScript = robot.GetComponent <Robot>();
        rPl         = robot.GetComponent <RobotPlanning>();
        rP          = robot.GetComponent <RobotProgress>();
        rDMUtility  = robot.GetComponent <RobotDMUtilityCloseWall>();

        rDMUtility.alpha             = startingAlpha;
        rDMUtility.beta              = startingBeta;
        robotScript.forgettingFactor = forgettingFactor[startingDelta];
        rP.pathMapNum = pathMapNum + iteration.ToString() + ".json";
        rP.pathPosNum = pathPosNum + iteration.ToString() + ".json";

        alpha      = startingAlpha;
        beta       = startingBeta;
        deltaIndex = startingDelta;

        //robotScript.SetVariables();
        rP.DefiningFolderAndFile();
        rP.SetAlpha(alpha);
        rP.SetBeta(beta);
        rP.SetDelta(forgettingFactor[deltaIndex]);
        rP.SetMapName(mapName);

        Debug.Log(rDMUtility.alpha);
        Debug.Log(rDMUtility.beta);
        Debug.Log(robotScript.forgettingFactor);

        StartCoroutine(timer);
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        finished     = false;
        pointToReach = ChoosingPointToReach();
        sendingRays  = SendingRays();
        //noPath = false;
        targetFound = false;
        rC          = GetComponent <RobotConnection>();
        rDM         = GetComponent <RobotDecisionMaking>();
        rM          = GetComponent <RobotMovement>();
        rP          = GetComponent <RobotProgress>();
        rPl         = GetComponent <RobotPlanning>();
        rPl.range   = rangeRays;
        landingRay.Add(new Ray(transform.position, Vector3.forward));
        angle = angleRay;

        InitializeRays();
    }
Example #4
0
    private void OnLevelWasLoaded(int level)
    {
        if (!isTheChosenOne)
        {
            Destroy(this.gameObject);
        }
        else
        {
            iteration = 1 + iteration;
            if (alpha < maxAlpha)
            {
                alpha = 0.1f + alpha;
            }
            else if (beta < maxBeta)
            {
                beta  = 0.1f + beta;
                alpha = minAlpha;
            }
            else if (deltaIndex < maxDeltaIndex)
            {
                deltaIndex = deltaIndex + 1;
                alpha      = minAlpha;
                beta       = minBeta;
            }

            filePathPosResNum = Application.dataPath + pathPosNum;
            if (File.Exists(filePathPosResNum))
            {
                fileContent = File.ReadAllText(filePathPosResNum);
                trajectory  = JsonUtility.FromJson <JsonRobotData>(fileContent);
                Debug.Log(trajectory.time);
                filePos.Close();
                if (trajectory.time == 0.0f)
                {
                    CheckIteration();
                }
            }

            if (alpha + beta < 1f)
            {
                CheckIteration();
            }

            timer                        = Timer();
            robot                        = GameObject.Find("Robot");
            robotScript                  = robot.GetComponent <Robot>();
            rPl                          = robot.GetComponent <RobotPlanning>();
            rP                           = robot.GetComponent <RobotProgress>();
            rDMUtility                   = robot.GetComponent <RobotDMUtilityCloseWall>();
            rDMUtility.alpha             = alpha;
            rDMUtility.beta              = beta;
            robotScript.forgettingFactor = forgettingFactor[deltaIndex];
            rP.pathMapNum                = pathMapNum + iteration.ToString() + ".json";
            rP.pathPosNum                = pathPosNum + iteration.ToString() + ".json";

            //robotScript.SetVariables();
            rP.DefiningFolderAndFile();
            rP.SetAlpha(alpha);
            rP.SetBeta(beta);
            rP.SetDelta(forgettingFactor[deltaIndex]);
            rP.SetMapName(mapName);

            Debug.Log(alpha);
            Debug.Log(beta);
            Debug.Log(forgettingFactor[deltaIndex]);

            StartCoroutine(timer);
        }
    }
 private void Start()
 {
     candidatePath = new List <Vector3>();
     rPL           = GetComponent <RobotPlanning>();
 }