Exemplo n.º 1
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()
        {
            // TODO: Add your initialization logic here
            robot    = new RobotData(this);
            robotSim = new RobotSim(this);
            this.Components.Add(robot);
            this.Components.Add(robotSim);

            // Setup viewing matrix for Simulation window
            cameraPosition   = new Vector3(2000.0f, 800.0f, 2000.0f);
            workSpace        = new Vector3(500.0f, 500.0f, 300.0f);
            aspectRatio      = graphics.GraphicsDevice.Viewport.AspectRatio;
            viewMatrix       = Matrix.CreateLookAt(cameraPosition, workSpace, Vector3.Up);
            projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 50000.0f);
            settings         = new XMLwriter();
            base.Initialize();
        }
Exemplo n.º 2
0
 public void updateRobot(RobotData robot)
 {
     using (MemoryStream stream = new MemoryStream())
     {
         using (XmlWriter updatePos = XmlWriter.Create(stream))
         {
             updatePos.WriteStartDocument();
             updatePos.WriteStartElement("Sen");
             updatePos.WriteAttributeString("Type", "ImFree");
             updatePos.WriteStartElement("RKorr");
             updatePos.WriteAttributeString("X", robot.KukaPosition.X.ToString());
             updatePos.WriteAttributeString("Y", robot.KukaPosition.Y.ToString());
             updatePos.WriteAttributeString("Z", robot.KukaPosition.Z.ToString());
             updatePos.WriteAttributeString("A", robot.KukaPosition.A.ToString());
             updatePos.WriteAttributeString("B", robot.KukaPosition.B.ToString());
             updatePos.WriteAttributeString("C", robot.KukaPosition.C.ToString());
             updatePos.WriteEndElement();
             updatePos.WriteEndElement();
             updatePos.WriteEndDocument();
         }
         bCommand = new byte[stream.ToArray().Length];
         bCommand = stream.ToArray();
     }
 }
Exemplo n.º 3
0
 public Server(int port, RobotData kukaRobot, RobotData simRobot)
 {
     this.tcpPort   = port;
     this.kukaRobot = kukaRobot;
     this.simRobot  = simRobot;
 }