public void OnConfirm()
    {
        var toggle = ModeGroup.GetActive();

        if (toggle.name == "Mode1")
        {
            command.mode = 0;
        }
        else if (toggle.name == "Mode2")
        {
            command.mode = 1;
        }
        if (timeField.text.Length != 0)
        {
            command.time = int.Parse(timeField.text);
        }
        if (energyField.text.Length != 0)
        {
            command.energy = int.Parse(energyField.text);
        }
        if (coordField.text != "Wrong string" && coordField.text.Length != 0)
        {
            command.command = RobotCommands.TelegaMoving(coordField.text);
            ModeGroup.SetActive(0);
            coordField.text = "";
            this.gameObject.SetActive(false);
        }
    }
Example #2
0
 void Update()
 {
     if (ObserverMode && Timer)
     {
         StartCoroutine(SendingLimiter(RobotCommands.GetSceneInf(), 1f));
     }
 }
Example #3
0
        // called when Gamecraft starts up
        public override void OnApplicationStart()
        {
            // Initialize the Gamecraft modding API first
            GamecraftModdingAPI.Main.Init();
            // check out the modding API docs here: https://mod.exmods.org/

            // Initialize Pixi mod
            CommandRoot root = new CommandRoot();

            // 2D Image Functionality
            root.Inject(new ImageCanvasImporter());
            root.Inject(new ImageTextBlockImporter());
            root.Inject(new ImageCommandImporter());
            // Robot functionality
            var robot = new RobotInternetImporter();

            root.Inject(robot);
            //RobotCommands.CreateRobotCRFCommand();
            //RobotCommands.CreateRobotFileCommand();
#if DEBUG
            // Development functionality
            RobotCommands.CreatePartDumpCommand();
            ((RobotBlueprintProvider)robot.BlueprintProvider).AddDebugCommands();
            root.Inject(new TestImporter());
#endif
            // Audio functionality
            root.Inject(new MidiImporter());
            root.Inject(new AudioFakeImporter());
        }
Example #4
0
    IEnumerator ScanCommand(float duration)
    {
        float startRotation = transform.eulerAngles.y;
        float t             = 0.0F;

        while (t <= duration)
        {
            t += Time.deltaTime;
            float yRotation = Mathf.Lerp(0.0F, 360.0F, t / duration);
            transform.eulerAngles = new Vector3(transform.eulerAngles.x, startRotation + yRotation,
                                                transform.eulerAngles.z);

            if (yRotation >= 360.0F)
            {
                break;
            }
            else
            {
                yield return(null);
            }
        }

        isRotationDone = true;
        currentCommand = commandScript.GetCommand();
    }
    public IEnumerator DirectionalMoving()
    {
        rc.aims.Insert(0, telega.PointA.transform.position);
        rc.aims.Insert(0, telega.PointA.transform.position + telega.A - telega.B);

        for (int i = 0; i < rc.aims.Count; ++i)
        {
            rc.aims[i] = new Vector3(rc.aims[i].x, telega.transform.position.y, rc.aims[i].z);
        }

        for (int j = 1; j < rc.aims.Count - 1; ++j)
        {
            a = rc.aims[j] - rc.aims[j - 1];
            b = rc.aims[j + 1] - rc.aims[j];

            angle = new float[3] {
                30f, -30f, 90f
            };
            float alpha = Mathf.Acos(Vector3.Dot(a.normalized, b.normalized)) * Mathf.Rad2Deg;
            dist = new float[3] {
                Mathf.Abs(Mathf.PI * 20f * alpha / 180f), Mathf.Abs(Mathf.PI * 20f * alpha / 180f), Mathf.Abs(Mathf.PI * 20f * alpha / 180f)
            };

            if (Vector3.Cross(a, b).y >= 0)
            {
                isReversed = new float[3] {
                    -1, -1, 1
                };
            }
            if (Vector3.Cross(a, b).y < 0)
            {
                isReversed = new float[3] {
                    1, 1, -1
                };
            }

            //SceneManager.Net.Sender(RobotCommands.TelegaMoving());
            var aimsRobot = CoordTransformation.UnityToRobotPosOnly(new Vector4(rc.aims[j].x, rc.aims[j].y, rc.aims[j].z, 1));
            SceneManager.Net.Sender(RobotCommands.TelegaMoving(aimsRobot[0].ToString("0.00"), aimsRobot[1].ToString("0.00")));
            yield return(new WaitForSeconds(0.5f));

            GameObject.Find("telega").GetComponent <telegaScript>().isMoved = true;



            float dst = Mathf.Sqrt((rc.aims[j + 1].x - rc.aims[j].x) * (rc.aims[j + 1].x - rc.aims[j].x) +
                                   (rc.aims[j + 1].z - rc.aims[j].z) * (rc.aims[j + 1].z - rc.aims[j].z)) * 1000f;
            dist = new float[3] {
                dst, dst, dst
            };
            isReversed[0] = isReversed[1] = isReversed[2] = 1;
            angle[0]      = angle[1] = angle[2] = 0;
            yield return(new WaitForSeconds(0.5f));

            GameObject.Find("telega").GetComponent <telegaScript>().isMoved = true;
        }
        rc.aims.RemoveAt(0);
        rc.aims.RemoveAt(0);
    }
Example #6
0
    // Update is called once per frame
    IEnumerator Click()
    {
        this.gameObject.GetComponent <Button>().interactable = false;
        SceneManager.Net.Sender(RobotCommands.Sensors());
        yield return(new WaitForSeconds(5));

        SceneManager.Net.Sender(RobotCommands.GetSceneInf());
        this.gameObject.GetComponent <Button>().interactable = true;
    }
Example #7
0
    IEnumerator CommandAfterDelay()
    {
        Debug.Log("CommandAfterDelay");
        yield return(new WaitForSeconds(commandDelay));

        if (currentPoint)
        {
            Debug.Log("getting command");
            currentCommand = commandScript.GetCommand();
        }
    }
Example #8
0
    void ActivateRobot()
    {
        //cameraManager.GetComponent<CameraManager>().SwitchCameras();
        isRobotRunning = true;
        commandScript  = gameObject.GetComponent <RobotCommandManager>();
        currentCommand = commandScript.commandList[0];
        standbyOverlay.SetActive(false);

        if (audioSource.clip)
        {
            audioSource.Play();
        }
    }
    IEnumerator CoordtoServer()
    {
        yield return(new WaitForSeconds(0.25f));

        if (mode == 0)
        {
            SceneManager.Net.Sender(RobotCommands.FanucMoving());
        }
        else
        {
            SceneManager.Net.Sender(RobotCommands.FanucMoving(false));
        }
        ReadytoSend = true;
    }
Example #10
0
    public static void Main()
    {
        int[,] sensorData = new int[3, 3];
        sensorData[1, 2]  = 0;
        sensorData[0, 0]  = 1;
        sensorData[0, 1]  = 1;
        sensorData[0, 2]  = 1;
        sensorData[1, 0]  = 1;
        sensorData[1, 1]  = 2;
        sensorData[2, 1]  = 1;
        sensorData[2, 2]  = 1;
        sensorData[2, 0]  = 1;
        RobotCommands obj = new RobotCommands();

        foreach (var item in obj.computeDirection(sensorData))
        {
            Console.WriteLine("The nodes are:" + item);
        }
    }
 void Getscene()
 {
     Sender(RobotCommands.GetSceneInf());
 }
Example #12
0
    public void OnConfirm()
    {
        var toggle = ModeGroup.GetActive();

        if (toggle.name == "Mode1")
        {
            command.mode = 0;
        }
        else if (toggle.name == "Mode2")
        {
            command.mode = 2;
        }

        var GraspToggle = GraspGroup.GetActive();

        if (GraspToggle.name == "Grasp0")
        {
            command.grasp = 0;
        }
        else if (GraspToggle.name == "Grasp+")
        {
            command.grasp = 1;
        }
        else if (GraspToggle.name == "Grasp-")
        {
            command.grasp = -1;
        }
        if (timeField.text.Length != 0)
        {
            command.time = int.Parse(timeField.text);
        }
        if (energyField.text.Length != 0)
        {
            command.energy = int.Parse(energyField.text);
        }
        if (nameField.text.Length != 0)
        {
            objName = nameField.text;
            if (LockInput(coordField) && (coordField.text.Length != 0))
            {
                command.command = RobotCommands.FanucMoving(coordField.text, objName);
                Debug.Log(RobotCommands.FanucMoving(coordField.text, objName));
                ModeGroup.SetActive(0);
                coordField.text = "";
                nameField.text  = "";
                GraspGroup.SetActive(2);
                //DoCommand();
                this.gameObject.SetActive(false);
                SceneManager.dropdownSceneObjects.gameObject.SetActive(false);
            }
        }

        if (LockInput(coordField) && coordField.text.Length != 0)
        {
            command.command = RobotCommands.FanucMoving(coordField.text);

            ModeGroup.SetActive(0);
            coordField.text = "";
            GraspGroup.SetActive(2);
            DoCommand();
            this.gameObject.SetActive(false);
            SceneManager.dropdownSceneObjects.gameObject.SetActive(false);
        }

        //throw new System.NotImplementedException();
    }
Example #13
0
 public RobotAction(RobotCommands _rCommand, object _data = null)
 {
     Command = _rCommand;
     Data    = _data;
 }
Example #14
0
        private void FillWithTestData()
        {
            // создали по одной сущности в каждый из списков
            var user = new User
            {
                Login    = MoqDataGenerator.GetRandomString(10),
                Password = MoqDataGenerator.GetRandomString(10),
                UserID   = 1
            };
            var robot = new Robot
            {
                RobotID        = MoqDataGenerator.GetRandomNumber(1, 100),
                Configurations = new List <Configuration>(),
                ProgramRobots  = new List <ProgramRobot>(),
                ActivationCode = MoqDataGenerator.GetRandomNumber(1, 100)
            };
            var program = CreateProgram(id: 1);

            var configuration = new Configuration
            {
                ConfigurationID = MoqDataGenerator.GetRandomNumber(10, 100),
                Port            = MoqDataGenerator.GetRandomNumber(10, 11111)
            };
            var programRobot = new ProgramRobot
            {
                ProgramRobotID = MoqDataGenerator.GetRandomNumber(10, 100)
            };

            var image = new Image
            {
                ImageMimeType = MoqDataGenerator.GetRandomString(10),
                ImageData     = MoqDataGenerator.GetSomeBytes(),
                ImageID       = 1,
                Name          = MoqDataGenerator.GetRandomString(10)
            };

            var robotCommand = new RobotCommand
            {
                RobotCommandID = MoqDataGenerator.GetRandomNumber(10, 100),
                Type           = 0
            };

            // добавили связи между сущностями
            robot.Configurations.Add(configuration);
            robot.ProgramRobots.Add(programRobot);
            robot.User            = user;
            robot.UserID          = user.UserID;
            configuration.Robot   = robot;
            configuration.RobotID = robot.RobotID;
            program.ProgramRobots.Add(programRobot);
            program.Image               = image;
            program.ImageID             = image.ImageID;
            programRobot.Robot          = robot;
            programRobot.Program        = program;
            programRobot.RobotID        = robot.RobotID;
            programRobot.ProgramID      = program.ProgramID;
            programRobot.CurrentVersion = program.ActualVersion - 1;
            robotCommand.Argument       = program.ProgramID;
            robotCommand.Robot          = robot;
            robotCommand.RobotID        = robot.RobotID;

            // добавили сущности в списки сущностей
            Robots.Add(robot);
            Programs.Add(program);
            Configurations.Add(configuration);
            ProgramRobots.Add(programRobot);
            Users.Add(user);
            RobotCommands.Add(robotCommand);
            Images.Add(image);

            // добавили еще 4 программы для теста pagination
            for (var i = 0; i < 4; i++)
            {
                Programs.Add(CreateProgram(i + 2));
            }
        }