Ejemplo n.º 1
0
    string CodeKuka(RobotSystem robotSystem, Target target)
    {
        var    number    = GetNumber(robotSystem);
        string textValue = Value ? "TRUE" : "FALSE";

        return($"WAIT FOR $IN[{number}]=={textValue}");
    }
Ejemplo n.º 2
0
    string CodeAbb(RobotSystem robotSystem, Target target)
    {
        var    io        = robotSystem.IO;
        string textValue = Value ? "1" : "0";

        return($"WaitDI {io.DI[DI]},{textValue};");
    }
Ejemplo n.º 3
0
        public UnityMeshPoser(RobotSystem robot, Material material)
        {
            _default = robot.DefaultPose;

            var allMeshes = _default.Meshes.SelectMany(m => m).ToList();

            _joints = new Transform[allMeshes.Count];

            var parent = GameObject.Find("Robot").transform;

            for (int i = 0; i < allMeshes.Count; i++)
            {
                string name = $"Joint {i}";
                var    go   = new GameObject(name, typeof(MeshFilter), typeof(MeshRenderer));

                var filter = go.GetComponent <MeshFilter>();
                filter.mesh = ToMesh(allMeshes[i], name);

                var renderer = go.GetComponent <MeshRenderer>();
                renderer.material = material;

                var transform = go.transform;
                transform.SetParent(parent);
                _joints[i] = transform;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            wandererWorld = Matrix.Identity;

            wanderer = new WandererBody(this);
            heightMapTransformSystem_Wanderer = new HeightMapTransformSystem_Wanderer();

            heightMapComponent       = new HeightMapComponent();
            heightMapCameraComponent = new HeightMapCameraComponent();

            robotComponent = new RobotComponent();

            heightMapSystem         = new HeightmapSystem();
            heightMapTranformSystem = new HeightMapTranformSystem();
            heightMapRenderSystem   = new HeightMapRenderSystem(graphics.GraphicsDevice);

            robotSystem         = new RobotSystem();
            robotTranformSystem = new RobotTranformSystem();
            robotRenderSystem   = new RobotRenderSystem();

            collisionSystem = new CollisionSystem();
            houseSystem     = new HouseSystem(this);

            systemRenderer = new Renderer();

            base.Initialize();
        }
Ejemplo n.º 5
0
 public CustomProgram(string name, RobotSystem robotSystem, List <int> multiFileIndices, List <List <List <string> > > code)
 {
     Name             = name;
     RobotSystem      = robotSystem;
     Code             = code;
     MultiFileIndices = multiFileIndices;
 }
Ejemplo n.º 6
0
    string CodeStaubli(RobotSystem robotSystem, Target target)
    {
        var    number    = GetNumber(robotSystem);
        string textValue = Value ? "true" : "false";

        return($"waitEndMove()\r\nwait(dis[{number}] == {textValue})");
    }
Ejemplo n.º 7
0
        string CodeUR(RobotSystem robotSystem, Target target)
        {
            //string textValue = Value ? "True" : "False";
            const string indent    = "  ";
            string       textValue = Value ? "not " : "";

            return($"while {textValue}get_digital_in({robotSystem.IO.DI[DI]}):\r\n{indent}{indent}sleep(0.008)\r\n{indent}end");
        }
Ejemplo n.º 8
0
    public static List <Mesh> Pose(RobotSystem robot, List <KinematicSolution> solutions, IList <Target> targets)
    {
        var tools = targets.Map(t => t.Tool);
        var poser = new RhinoMeshPoser(robot);

        poser.Pose(solutions, tools);
        return(poser.Meshes);
    }
Ejemplo n.º 9
0
    string GetNumber(RobotSystem robotSystem)
    {
        var io = robotSystem.IO;

        return(io.UseControllerNumbering
         ? DO.ToString()
         : io.DO[DO]);
    }
Ejemplo n.º 10
0
    public RhinoMeshPoser(RobotSystem robot)
    {
        _default = robot.DefaultPose;

        var meshCount = _default.Meshes.Sum(m => m.Count + 1);

        Meshes = new List <Mesh>(meshCount);
    }
Ejemplo n.º 11
0
    string CodeUR(RobotSystem robotSystem, Target target)
    {
        var          number    = GetNumber(robotSystem);
        const string indent    = "  ";
        string       textValue = Value ? "not " : "";

        return($"while {textValue}get_digital_in({number}):\r\n{indent}{indent}sleep(0.008)\r\n{indent}end");
    }
Ejemplo n.º 12
0
    string CodeUR(RobotSystem robotSystem, Target target)
    {
        var number = GetNumber(robotSystem);

        string textValue = Value ? "True" : "False";

        return($"set_digital_out({number},{textValue})");
    }
    private void Awake()
    {
        instance = this;

        this.SpawnedRobotDictionary = new Dictionary <string, RobotBase>();
        this.SpawnedRobotList       = new List <RobotBase>();
        this.StoredRobotSourceCodes = new List <RobotSourceCode>();
    }
Ejemplo n.º 14
0
 protected override void ErrorChecking(RobotSystem robotSystem)
 {
     if (robotSystem.IO.AO == null)
     {
         throw new Exception(" Robot contains no analog outputs.");
     }
     if (AO > robotSystem.IO.AO.Length - 1)
     {
         throw new Exception(" Index of analog output is too high.");
     }
 }
Ejemplo n.º 15
0
 protected override void ErrorChecking(RobotSystem robotSystem)
 {
     if (robotSystem.IO.DI == null)
     {
         throw new Exception(" Robot contains no digital inputs.");
     }
     if (DI > robotSystem.IO.DI.Length - 1)
     {
         throw new Exception(" Index of digital inputs is too high.");
     }
 }
Ejemplo n.º 16
0
 protected override string CodeAbb(RobotSystem robotSystem, Target target)
 {
     if (target.Zone.IsFlyBy)
     {
         return($@"WaitTime {this.Name};");
     }
     else
     {
         return($@"WaitTime \InPos,{this.Name};");
     }
 }
Ejemplo n.º 17
0
 protected override string CodeKuka(RobotSystem robotSystem, Target target)
 {
     if (target.Zone.IsFlyBy)
     {
         return($"CONTINUE\r\nWAIT SEC {this.Name}");
     }
     else
     {
         return($"WAIT SEC {this.Name}");
     }
 }
Ejemplo n.º 18
0
 string CodeAbb(RobotSystem robotSystem, Target target)
 {
     if (target.Zone.IsFlyBy)
     {
         return($"WaitTime {Name};");
     }
     else
     {
         return($@"WaitTime \InPos,{Name};");
     }
 }
Ejemplo n.º 19
0
 protected override string CodeKuka(RobotSystem robotSystem, Target target)
 {
     if (target.Zone.IsFlyBy)
     {
         return($"CONTINUE\r\nPULSE($OUT[{robotSystem.IO.DO[DO]}],TRUE,{length:0.00})");
     }
     else
     {
         return($"PULSE($OUT[{robotSystem.IO.DO[DO]}],TRUE,{length:0.00})");
     }
 }
Ejemplo n.º 20
0
    string DeclarationUR(RobotSystem robotSystem)
    {
        var number = GetNumber(robotSystem);

        string time   = $"{Name} = {_length:0.###}";
        string thread = $@"  thread run{Name}():
    sleep({Name})
    set_digital_out({number}, False)
  end";

        return($"{time}\r\n{thread}");
    }
Ejemplo n.º 21
0
    string CodeKuka(RobotSystem robotSystem, Target target)
    {
        var number = GetNumber(robotSystem);

        if (target.Zone.IsFlyBy)
        {
            return($"CONTINUE\r\nPULSE($OUT[{number}],TRUE,{_length:0.###})");
        }
        else
        {
            return($"PULSE($OUT[{number}],TRUE,{_length:0.###})");
        }
    }
Ejemplo n.º 22
0
        protected override string CodeKuka(RobotSystem robotSystem, Target target)
        {
            string textValue = Value ? "TRUE" : "FALSE";

            if (target.Zone.IsFlyBy)
            {
                return($"CONTINUE\r\n$OUT[{robotSystem.IO.DO[DO]}] = {textValue}");
            }
            else
            {
                return($"$OUT[{robotSystem.IO.DO[DO]}] = {textValue}");
            }
        }
Ejemplo n.º 23
0
        protected override string CodeAbb(RobotSystem robotSystem, Target target)
        {
            string textValue = Value ? "1" : "0";

            if (target.Zone.IsFlyBy)
            {
                return($"SetDO {robotSystem.IO.DO[DO]},{textValue};");
            }
            else
            {
                return($@"SetDO \Sync ,{robotSystem.IO.DO[DO]},{textValue};");
            }
        }
Ejemplo n.º 24
0
    internal CheckProgram(Program program, List <CellTarget> cellTargets, double stepSize)
    {
        _robotSystem = program.RobotSystem;
        _program     = program;

        FixFirstTarget(cellTargets[0]);
        FixTargetAttributes(cellTargets);
        var indexError = FixTargetMotions(cellTargets, stepSize);

        FixedTargets = (indexError != -1)
             ? cellTargets.GetRange(0, indexError + 1)
             : cellTargets;
    }
Ejemplo n.º 25
0
    string CodeAbb(RobotSystem robotSystem, Target target)
    {
        var    io        = robotSystem.IO;
        string textValue = Value ? "1" : "0";

        if (target.Zone.IsFlyBy)
        {
            return($"SetDO {io.DO[DO]},{textValue};");
        }
        else
        {
            return($@"SetDO \Sync ,{io.DO[DO]},{textValue};");
        }
    }
Ejemplo n.º 26
0
    string CodeKuka(RobotSystem robotSystem, Target target)
    {
        var    number    = GetNumber(robotSystem);
        string textValue = Value ? "TRUE" : "FALSE";

        if (target.Zone.IsFlyBy)
        {
            return($"CONTINUE\r\n$OUT[{number}] = {textValue}");
        }
        else
        {
            return($"$OUT[{number}] = {textValue}");
        }
    }
Ejemplo n.º 27
0
        public static List <Mesh> PoseMeshes(RobotSystem robot, List <KinematicSolution> solutions, List <Mesh> tools)
        {
            var cell = robot as RobotCell;

            if (cell != null)
            {
                var meshes = solutions.SelectMany((_, i) => PoseMeshes(cell.MechanicalGroups[i], solutions[i].Planes, tools[i])).ToList();
                return(meshes);
            }
            else
            {
                var ur     = robot as RobotCellUR;
                var meshes = PoseMeshesRobot(ur.Robot, solutions[0].Planes, tools[0]);
                return(meshes);
            }
        }
Ejemplo n.º 28
0
        //发送处理完的所有的robot的信息
        public void send_robots_data()
        {
            List <Robot> robots = RobotSystem.get_singleton().get_robots();

            lock (robots)
            {
                foreach (Robot robot in robots)
                {
                    Queue <NetworkMsg> sendQue = robot.m_clientSocket.load_send_queue();
                    while (sendQue.Count > 0)
                    {
                        NetworkMsg msg = sendQue.Dequeue();
                        m_tcpServer.send_networkMessage(msg, robot.m_clientSocket.m_socket);
                    }
                }
            }
        }
Ejemplo n.º 29
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string   name      = null;
            GH_Plane basePlane = null;

            if (!DA.GetData(0, ref name))
            {
                return;
            }
            if (!DA.GetData(1, ref basePlane))
            {
                return;
            }

            var robotSystem = RobotSystem.Load(name, basePlane.Value);;

            DA.SetData(0, new GH_RobotSystem(robotSystem));
        }
Ejemplo n.º 30
0
    public HelixMeshPoser(RobotSystem robot, PBRMaterial material, ObservableElement3DCollection robotModels)
    {
        _default     = robot.DefaultPose;
        _robotModels = robotModels;

        foreach (var joint in _default.Meshes.SelectMany(m => m))
        {
            var model = new MeshGeometryModel3D
            {
                Geometry         = ToWPF(joint),
                Material         = material,
                Transform        = Transform3D.Identity,
                IsThrowingShadow = true
            };

            robotModels.Add(model);
        }
    }