public UpdateWithFlyOptomotorResponse(IServiceContainer wObj, Game game)
            : base(wObj, game)
        {
            //load all necessary services
            flyPos  = (KalmanFilterTrack)game.Services.GetService(typeof(KalmanFilterTrack));
            posServ = (PositionService)wObj.GetService(typeof(PositionService));
            pType   = (VRProtocol)game.Services.GetService(typeof(VRProtocol));
            name    = (NameService)wObj.GetService(typeof(NameService));
            if ((UpdateSubsystem)game.Services.GetService(typeof(UpdateSubsystem)) != null)
            {
                //add this update service to the update subsystem list
                UpdateSubsystem us = (UpdateSubsystem)game.Services.GetService(typeof(UpdateSubsystem));
                us.AddUpdateService(name.ObjectName() + "UpdateWithFlyOptomotorResponse", this);
            }
            pType.pType = VRProtocolType.ClosedLoop;

            //calibration values
            c[0]  = 0.0012f;
            c[1]  = -0.8937f;
            c[2]  = 0.0000f;
            c[3]  = 0.0005f;
            c[4]  = 1;
            c[5]  = 0.0013f;
            c[6]  = -0.0000f;
            c[7]  = -0.3741f;
            c[8]  = 11.6243f;
            c[9]  = 5.6421f;
            c[10] = -12.9017f;
            c[11] = -0.9338f;

            //protocol trial structure load (pre-defined)
            frames   = GetFrames();
            protocol = GetProtocol();
        }
Exemplo n.º 2
0
 /* When the Remove model button is pressed */
 private void RemoveModelButton_Click(object sender, EventArgs e)
 {
     if (this.wObj.GetService(typeof(Model)) != null)
     {
         RenderSubsystem render = (RenderSubsystem)this.createWorld.game.Services.GetService(typeof(RenderSubsystem));
         if (this.wObj.ContainService(typeof(NameService)))
         {
             NameService name = (NameService)this.wObj.GetService(typeof(NameService));
             render.DrawServices.Remove(name.ObjectName());
             this.wObj.RemoveService(typeof(Model));
             this.wObj.RemoveService(typeof(DrawService));
             this.StringModel.Text = "";
             if (System.IO.Directory.Exists(this.createWorld.contentBuilder.OutputDirectory + "\\" + name.ObjectName() + ".xnb"))
             {
                 System.IO.Directory.Delete(this.createWorld.contentBuilder.OutputDirectory + "\\" + name.ObjectName() + ".xnb");
             }
         }
     }
     else
     {
         if (this.wObj.ContainService(typeof(NameService)))
         {
             NameService name = (NameService)this.wObj.GetService(typeof(NameService));
             this.StringModel.Text = "";
             if (System.IO.Directory.Exists(this.createWorld.contentBuilder.OutputDirectory + "\\" + name.ObjectName() + ".xnb"))
             {
                 System.IO.Directory.Delete(this.createWorld.contentBuilder.OutputDirectory + "\\" + name.ObjectName() + ".xnb");
             }
         }
     }
 }
Exemplo n.º 3
0
        /* Remove a World Object from the World Object list of its parent */
        public void RemoveParent(TreeNode node, TreeNode parentNode)
        {
            WorldObject worldObj = (WorldObject)parentNode.Tag;
            WorldObject objj     = (WorldObject)node.Tag;
            NameService nameC    = (NameService)objj.GetService(typeof(NameService));

            worldObj.RemoveWorldObject(nameC.ObjectName());
            parentNode.Tag = worldObj;
        }
Exemplo n.º 4
0
 // Remove a child WorldObject from the WorldObject list using its name
 public void RemoveWorldObject(string str)
 {
     foreach (WorldObject obj in WObjects)
     {
         NameService Name = (NameService)obj.GetService(typeof(NameService));
         if (str == Name.ObjectName())
         {
             WObjects.Remove(obj);
         }
     }
 }
Exemplo n.º 5
0
        /* When the Remove button is pressed remove the selected node */
        private void RemoveObject_Click(object sender, EventArgs e)
        {
            RenderSubsystem renderSubsystem = (RenderSubsystem)this.game.Services.GetService(typeof(RenderSubsystem));
            UpdateSubsystem updateSubsystem = (UpdateSubsystem)this.game.Services.GetService(typeof(UpdateSubsystem));

            if (this.ObjectList.SelectedNode != this.ObjectList.TopNode)
            {
                WorldObject obj  = (WorldObject)this.ObjectList.SelectedNode.Tag;
                NameService name = (NameService)obj.GetService(typeof(NameService));
                if (name.name != "Fly")
                {
                    if (renderSubsystem.DrawServices.ContainsKey(name.ObjectName()))
                    {
                        renderSubsystem.DrawServices.Remove(name.ObjectName());
                    }
                    RemoveParent(this.ObjectList.SelectedNode, this.ObjectList.SelectedNode.Parent);
                }
                this.ObjectList.SelectedNode.Remove();
            }
        }
Exemplo n.º 6
0
 // Get a child WorldObject from the WorldObject list using its name
 public WorldObject GetWorldObject(string str)
 {
     foreach (WorldObject obj in WObjects)
     {
         NameService Name = (NameService)obj.GetService(typeof(NameService));
         if (str == Name.ObjectName())
         {
             return(obj);
         }
     }
     return(null);
 }
        public UpdateWithFlyNGRG(IServiceContainer wObj, Game game)
            : base(wObj, game)
        {
            //load all necessary services
            flyPos  = (KalmanFilterTrack)game.Services.GetService(typeof(KalmanFilterTrack));
            posServ = (PositionService)wObj.GetService(typeof(PositionService));
            pType   = (VRProtocol)game.Services.GetService(typeof(VRProtocol));
            name    = (NameService)wObj.GetService(typeof(NameService));
            if ((UpdateSubsystem)game.Services.GetService(typeof(UpdateSubsystem)) != null)
            {
                //add this update service to the update subsystem list
                UpdateSubsystem us = (UpdateSubsystem)game.Services.GetService(typeof(UpdateSubsystem));
                us.AddUpdateService(name.ObjectName() + "UpdateWithFly", this);
            }
            pType.pType = VRProtocolType.ClosedLoop;

            //calibration values
            c[0]  = 0.0012f;
            c[1]  = -0.8937f;
            c[2]  = 0.0000f;
            c[3]  = 0.0005f;
            c[4]  = 1;
            c[5]  = 0.0013f;
            c[6]  = -0.0000f;
            c[7]  = -0.3741f;
            c[8]  = 11.6243f;
            c[9]  = 5.6421f;
            c[10] = -12.9017f;
            c[11] = -0.9338f;

            //protocol trial structure load
            v      = new string[pType.trials.Count];
            frames = new int[pType.trials.Count];
            for (int i = 0; i < pType.trials.Count; i++)
            {
                frames[i] = (int)(1 + i) * Convert.ToInt32(pType.tDuration);
                v[i]      = pType.trials.ElementAt(i);
            }
        }