Example #1
0
    public InstructionDefinitionWindow(MMIAvatar avatar, ref MInstruction rootInstruction, MInstruction availableInstruction = null)
    {
        this.avatar          = avatar;
        this.mmuDescriptions = this.avatar.MMUAccess.GetLoadableMMUs();


        this.motionTypeOptions = mmuDescriptions.Select(s => s.MotionType).ToArray();
        this.instructionList   = rootInstruction.Instructions;

        if (availableInstruction == null)
        {
            this.instruction            = new MInstruction();
            this.instruction.ID         = MInstructionFactory.GenerateID();
            this.instruction.Properties = new Dictionary <string, string>();
        }
        else
        {
            this.instruction = availableInstruction;

            //Preselect the motion type
            if (this.motionTypeOptions.Contains(this.instruction.MotionType))
            {
                this.motionTypeIndex = this.motionTypeOptions.ToList().IndexOf(this.instruction.MotionType);
            }
        }
    }
        public override MBoolResponse AssignInstruction(MInstruction instruction, MSimulationState simulationState)
        {
            this.instruction = instruction;

            //Get the carry object (if available)
            this.carryObject = this.SceneAccess.GetSceneObjectByID(instruction.Properties["TargetID"]);


            //Add the carry object to the virtual scene
            this.virtualScene.Apply(new MSceneUpdate()
            {
                AddedSceneObjects = new List <MSceneObject>()
                {
                    carryObject
                }
            }, true);

            //Create a new id for the instruction
            this.currentInstructionID = MInstructionFactory.GenerateID();

            //Create a new subinstruction utilizing the  moving target
            MInstruction subInstruction = new MInstruction(currentInstructionID, "NestedMove", "move")
            {
                Properties = PropertiesCreator.Create("TargetID", moveTarget.ID, "SubjectID", instruction.Properties["TargetID"], "Hand", instruction.Properties["Hand"])
            };

            //Assign the instruction at the co-simulation and create a new wrapper instruction
            return(this.coSimulator.AssignInstruction(subInstruction, simulationState));
        }
Example #3
0
    /// <summary>
    /// Basic constructor
    /// </summary>
    /// <param name="avatar"></param>
    public BehaviorDefinitionWindow(MMIAvatar avatar)
    {
        this.avatar          = avatar;
        this.rootInstruction = new MInstruction()
        {
            Instructions = new List <MInstruction>(),
            ID           = MInstructionFactory.GenerateID(),
            MotionType   = "Composite"
        };

        this.instructionsArray = this.rootInstruction.Instructions.Select(s => s.Name + " , " + s.MotionType + " , " + s.ID).ToArray();
    }
    private void StartInstruction()
    {
        this.WalkTarget.transform.position = new Vector3(Random.Range(-9, 9), 0, Random.Range(-9, 9));
        this.WalkTarget.Synchronize();

        this.currentInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Walk", "Locomotion/Walk")
        {
            Properties = new Dictionary <string, string>()
            {
                { "TargetID", this.WalkTarget.MSceneObject.ID },
                { "ForcePath", true.ToString() },
                { "UseTargetOrientation", false.ToString() }
            }
        };

        this.CoSimulator.AssignInstruction(this.currentInstruction, null);
    }
Example #5
0
        /// <summary>
        /// Basic update routine
        /// </summary>
        void Update()
        {
            ///Handle the walk command on mouse click
            if (Input.GetKey(KeyCode.LeftShift) && Input.GetMouseButtonDown(0))
            {
                Vector3 mousePos = Input.mousePosition;


                Ray        mouseRay = Camera.main.ScreenPointToRay(mousePos);
                RaycastHit hit      = new RaycastHit();

                if (Physics.Raycast(mouseRay, out hit, 10000))
                {
                    //Ray for visual guide from camera to mouse position.
                    Debug.DrawRay(mouseRay.origin, mouseRay.direction * hit.distance, Color.red, 1);

                    GameObject walkTarget = GameObject.Find("WalkTarget");
                    walkTarget.transform.position = new Vector3(hit.point.x, walkTarget.transform.position.y, hit.point.z);
                    walkTarget.GetComponent <MMISceneObject>().UpdateTransform();


                    MInstruction walkInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Walk", "Locomotion/Walk")
                    {
                        Properties = PropertiesCreator.Create("TargetName", "WalkTarget", "UseTargetOrientation", false.ToString())
                    };

                    MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", "Pose/Idle")
                    {
                        //Start idle after walk has been finished
                        StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End //synchronization constraint similar to bml "id:End"  (bml original: <bml start="id:End"/>
                    };

                    //Abort all current tasks
                    this.CoSimulator.Abort();

                    MSimulationState currentState = new MSimulationState()
                    {
                        Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
                    };

                    //Assign walk and idle instruction
                    this.CoSimulator.AssignInstruction(walkInstruction, currentState);
                    this.CoSimulator.AssignInstruction(idleInstruction, currentState);
                }
            }
        }
Example #6
0
        /// <summary>
        ///     Walk to selected object
        /// </summary>
        public void WalkTo()
        {
            GameObject go;
            GameObject walkTarget;

            try
            {
                //Get selected object
                go = selectObject.GetObject();
            }
            catch (NullReferenceException)
            {
                SSTools.ShowMessage("No object selected", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }

            //If walk target is selected, switch to parent
            if (go.transform.name.Equals("WalkTarget"))
            {
                go = go.transform.parent.gameObject;
            }

            try
            {
                //Get walk target of selected object
                //walkTarget = go.transform.GetChildRecursiveByName("WalkTarget").gameObject;
                walkTarget = go.transform.Find("WalkTarget").gameObject;
            }
            catch (NullReferenceException)
            {
                SSTools.ShowMessage("No walk target found", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }
            String objectID = walkTarget.GetComponent <MMISceneObject>().MSceneObject.ID;

            //Create instruction
            MInstruction walkInstruction =
                new MInstruction(MInstructionFactory.GenerateID(), "Walk", "Locomotion/Walk")
            {
                Properties = PropertiesCreator.Create("TargetID", objectID, "ForcePath", "true")
            };

            //Add instruction to queue
            queueController.AddItem(walkInstruction, "Walk to " + go.name);
        }
Example #7
0
        /// <summary>
        /// Function is called to control the avatar by using predefined buttons in the GUI.
        /// </summary>
        protected virtual void GUIBehaviorInput()
        {
            if (GUI.Button(new Rect(10, 10, 120, 50), "Idle"))
            {
                MInstruction instruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", "Pose/Idle");
                //MInstruction instruction = new MInstruction(MInstructionFactory.GenerateID(), "MMUTest", "move");
                MSimulationState simstate = new MSimulationState(this.avatar.GetPosture(), this.avatar.GetPosture());

                this.CoSimulator.Abort();
                this.CoSimulator.AssignInstruction(instruction, simstate);
            }


            if (GUI.Button(new Rect(140, 10, 120, 50), "Walk to"))
            {
                MInstruction walkInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Walk", "Locomotion/Walk")
                {
                    Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTarget").ID)
                };

                MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", "Pose/Idle")
                {
                    //Start idle after walk has been finished
                    StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End //synchronization constraint similar to bml "id:End"  (bml original: <bml start="id:End"/>
                };

                this.CoSimulator.Abort();


                MSimulationState currentState = new MSimulationState()
                {
                    Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
                };

                //Assign walk and idle instruction
                this.CoSimulator.AssignInstruction(walkInstruction, currentState);
                this.CoSimulator.AssignInstruction(idleInstruction, currentState);
                this.CoSimulator.MSimulationEventHandler += this.CoSimulator_MSimulationEventHandler;
            }
        }
Example #8
0
    protected override void GUIBehaviorInput()
    {
        if (GUI.Button(new Rect(10, 10, 120, 50), "Idle"))
        {
            MSkeletonAccess.Iface skeletonAccess = this.avatar.GetSkeletonAccess();
            skeletonAccess.SetChannelData(this.avatar.GetPosture());



            MInstruction instruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE);
            //MInstruction instruction = new MInstruction(MInstructionFactory.GenerateID(), "MMUTest", "Object/Move");
            MSimulationState simstate = new MSimulationState(this.avatar.GetPosture(), this.avatar.GetPosture());



            this.CoSimulator.Abort();
            this.CoSimulator.AssignInstruction(instruction, simstate);
        }
        if (GUI.Button(new Rect(140, 10, 120, 50), "Walk to"))
        {
            MInstruction walkInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Walk", MOTION_WALK)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTarget").ID)
            };

            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                //Start idle after walk has been finished
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End //synchronization constraint similar to bml "id:End"  (bml original: <bml start="id:End"/>
            };

            this.CoSimulator.Abort();


            MSimulationState currentState = new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            };

            //Assign walk and idle instruction
            this.CoSimulator.AssignInstruction(walkInstruction, currentState);
            this.CoSimulator.AssignInstruction(idleInstruction, currentState);
            this.CoSimulator.MSimulationEventHandler += this.CoSimulator_MSimulationEventHandler;
        }


        if (GUI.Button(new Rect(270, 10, 120, 50), "Reach Object"))
        {
            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE);


            MInstruction reachRight = new MInstruction(MInstructionFactory.GenerateID(), "reach right", MOTION_REACH)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTargetR"].ID, "Hand", "Right", "MinDistance", 2.0.ToString()),
            };


            //MInstruction reachLeft = new MInstruction(MInstructionFactory.GenerateID(), "reach left", "Pose/Reach")
            //{
            //    Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTargetL"].ID, "Hand", "Left"),
            //};

            //this.CoSimulator.Abort();
            this.CoSimulator.AssignInstruction(idleInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(reachRight, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            //this.CoSimulator.AssignInstruction(reachLeft, new MSimulationState() { Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture() });
        }


        if (GUI.Button(new Rect(400, 10, 120, 50), "Move Object"))
        {
            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE);

            MInstruction moveObject = new MInstruction(MInstructionFactory.GenerateID(), "move object", MOTION_MOVE)
            {
                Properties = PropertiesCreator.Create("SubjectID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Right", "TargetID", UnitySceneAccess.Instance["PositioningTarget"].ID),
            };

            this.CoSimulator.Abort();
            this.CoSimulator.AssignInstruction(idleInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(moveObject, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }


        if (GUI.Button(new Rect(530, 10, 120, 50), "Pick-up"))
        {
            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE);

            MInstruction reachInstruction = new MInstruction(MInstructionFactory.GenerateID(), "reach", MOTION_REACH)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTargetR"].ID, "Hand", "Right"),
            };

            carryID = MInstructionFactory.GenerateID();
            MInstruction carryInstruction = new MInstruction(carryID, "carry object", MOTION_CARRY)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Right"),
                StartCondition = reachInstruction.ID + ":" + mmiConstants.MSimulationEvent_End + "+ 0.01"
            };


            this.CoSimulator.AssignInstruction(idleInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(reachInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(carryInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.MSimulationEventHandler += this.CoSimulator_MSimulationEventHandler;
        }

        if (GUI.Button(new Rect(660, 10, 120, 50), "Carry Object"))
        {
            carryID = MInstructionFactory.GenerateID();
            MInstruction carryInstruction = new MInstruction(carryID, "carry object", MOTION_CARRY)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Right")//, "CarryTarget", UnitySceneAccess.Instance["CarryTarget"].ID),
            };

            this.CoSimulator.AssignInstruction(carryInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }



        if (GUI.Button(new Rect(790, 10, 120, 50), "Release Object"))
        {
            MInstruction releaseRight = new MInstruction(MInstructionFactory.GenerateID(), "release object", MOTION_RELEASE)
            {
                Properties = PropertiesCreator.Create("Hand", "Right", CoSimTopic.OnStart, carryID + ":" + CoSimAction.EndInstruction),
            };
            MInstruction releaseLeft = new MInstruction(MInstructionFactory.GenerateID(), "release object", MOTION_RELEASE)
            {
                Properties = PropertiesCreator.Create("Hand", "Left", CoSimTopic.OnStart, carryID + ":" + CoSimAction.EndInstruction),
            };


            this.CoSimulator.AssignInstruction(releaseRight, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(releaseLeft, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }
    }
Example #9
0
    // Update is called once per frame
    void Update()
    {
        if (Execute && !lastState)
        {
            //Pickup the object
            MSimulationState state = new MSimulationState(this.avatar.GetPosture(), this.avatar.GetPosture());


            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "idle: " + ObjectToTurn.name, "idle");

            MInstruction reachInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Reach: " + ObjectToTurn.name, "Pose/Reach")
            {
                Properties = new Dictionary <string, string>()
                {
                    { "Hand", "Right" },
                    { "TargetID", GraspTarget.MSceneObject.ID }
                }
            };


            if (this.HandPose != null)
            {
                MInstruction moveFingersInstruction = new MInstruction(System.Guid.NewGuid().ToString(), "Move fingers", "Pose/MoveFingers")
                {
                    Properties = new Dictionary <string, string>()
                    {
                        { "Hand", this.HandPose.HandType.ToString() }
                    },
                    Constraints    = new List <MConstraint>(),
                    StartCondition = reachInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
                };

                if (HandPose != null)
                {
                    string constraintID = Guid.NewGuid().ToString();
                    moveFingersInstruction.Properties.Add("HandPose", constraintID);
                    moveFingersInstruction.Constraints.Add(new MConstraint()
                    {
                        ID = constraintID,
                        PostureConstraint = HandPose.GetPostureConstraint()
                    });
                }


                this.avatar.CoSimulator.AssignInstruction(moveFingersInstruction, state);
            }

            MInstruction turnObjectInstruction = new MInstruction(Guid.NewGuid().ToString(), "turn: " + ObjectToTurn.name, "Object/Turn")
            {
                Properties = new Dictionary <string, string>()
                {
                    { "SubjectID", ObjectToTurn.MSceneObject.ID },
                    { "Axis", this.TurnAxis.MSceneObject.ID },
                    { "Repetitions", this.Repetitions.ToString() },
                    { "Angle", this.Angle.ToString(System.Globalization.CultureInfo.InvariantCulture) },
                    { "Hand", Hand.ToString() }
                },
                Constraints    = new List <MConstraint>(),
                StartCondition = reachInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            InstructionValidation validator = new InstructionValidation();
            MBoolResponse         res       = validator.Validate(turnObjectInstruction, this.avatar.MMUAccess.GetLoadableMMUs());

            if (!res.Successful)
            {
                foreach (string s in res.LogData)
                {
                    Debug.LogError(s);
                }
            }

            this.avatar.CoSimulator.AssignInstruction(idleInstruction, state);
            this.avatar.CoSimulator.AssignInstruction(reachInstruction, state);
            this.avatar.CoSimulator.AssignInstruction(turnObjectInstruction, state);
        }

        if (!Execute && lastState)
        {
            //Terminate
            this.avatar.CoSimulator.Abort();
        }

        lastState = Execute;
    }
Example #10
0
        /// <summary>
        ///     Place selected object
        /// </summary>
        public void MoveObject()
        {
            GameObject obj;

            try
            {
                //Get selected object
                obj = selectObject.GetObject();
            }
            catch (NullReferenceException)
            {
                SSTools.ShowMessage("No object selected", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }

            //If move target is selected, switch to parent
            if (MoveTargetChecker.IsMoveTarget(obj))
            {
                obj = obj.transform.parent.gameObject;
            }

            if (!HandChecker.HasHands(obj))
            {
                SSTools.ShowMessage("No hands placed", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }

            GameObject positionTarget;

            try
            {
                //Get move target
                positionTarget = obj.transform.Find("moveTarget").gameObject;
            }
            catch (NullReferenceException)
            {
                SSTools.ShowMessage("No move target defined", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }

            //List for instructions
            List <MInstruction> list = new List <MInstruction>();

            //Get IDs of objects
            String objectID         = obj.GetComponent <MMISceneObject>().MSceneObject.ID;
            String targetPositionID = positionTarget.GetComponent <MMISceneObject>().MSceneObject.ID;

            //Instruction if both hands are present on object
            if (HandChecker.HasBothHands(obj))
            {
                MInstruction moveObject = new MInstruction(MInstructionFactory.GenerateID(), "move object", "Object/Move")
                {
                    Properties = PropertiesCreator.Create("SubjectID", objectID, "Hand",
                                                          "Both", "TargetID", targetPositionID, CoSimTopic.OnStart,
                                                          _carryIDManager.CurrentCarryIdBoth + ":" + CoSimAction.EndInstruction)
                };
                list.Add(moveObject);
            }

            //Instruction if only right hand is present on object
            else if (HandChecker.HasRightHand(obj))
            {
                MInstruction moveObject = new MInstruction(MInstructionFactory.GenerateID(), "move object", "Object/Move")
                {
                    Properties = PropertiesCreator.Create("SubjectID", objectID, "Hand",
                                                          "Right", "TargetID", targetPositionID, CoSimTopic.OnStart,
                                                          _carryIDManager.CurrentCarryIdRight + ":" + CoSimAction.EndInstruction)
                };
                list.Add(moveObject);
            }

            //Instruction if only left hand is present on object
            else if (HandChecker.HasLeftHand(obj))
            {
                MInstruction moveObject = new MInstruction(MInstructionFactory.GenerateID(), "move object", "Object/Move")
                {
                    Properties = PropertiesCreator.Create("SubjectID", objectID, "Hand",
                                                          "Left", "TargetID", targetPositionID, CoSimTopic.OnStart,
                                                          _carryIDManager.CurrentCarryIdLeft + ":" + CoSimAction.EndInstruction)
                };
                list.Add(moveObject);
            }
            //Indicates that an object has been moved and thus the Carry Instruction is finished
            pickedUp = false;

            //Add instructions to queue
            queueController.AddItem(list, "Place " + obj.name);
        }
Example #11
0
    /// <summary>
    ///     Play list of instructions
    /// </summary>
    /// <param name="list">Instructions to play</param>
    public void RunInstruction(List <MInstruction> list)
    {
        //IdleInstruction to ensure a underlying instruction to fall back
        string       idleInstructionID = MInstructionFactory.GenerateID();
        MInstruction idleInstruction   = new MInstruction(idleInstructionID, "Idle", "Pose/Idle");

        //Add Event handler
        this.CoSimulator.MSimulationEventHandler += this.CoSimulator_MSimulationEventHandler;


        //Instruction for signal an finished queue
        MInstruction defaultInstruction = new MInstruction(MInstructionFactory.GenerateID(), "FinishedQueue", "Pose/Idle")
        {
            StartCondition = list[list.Count - 1].ID + ":" + mmiConstants.MSimulationEvent_End + "+ 0.1",
            Properties     = PropertiesCreator.Create(CoSimTopic.OnStart,
                                                      idleInstructionID + ":" + CoSimAction.EndInstruction)
        };

        list.Add(defaultInstruction);


        for (int i = 0; i < list.Count; i++)
        {
            if (i > 0)
            {
                if (list[i - 1].Name.Equals("carry object"))
                {
                    list[i].StartCondition = list[i - 1].ID + ":" + "PositioningFinished + 0.1";
                }
                else if (list[i - 1].Name.Equals("Move Fingers"))
                {
                    list[i].StartCondition = list[i - 1].ID + ":" + "FingersPositioned + 0.1";
                }
                else if (list[i - 1].Name.Equals("Release Fingers"))
                {
                    list[i].StartCondition = list[i - 1].StartCondition;
                    //list[i].StartCondition = list[i - 1].ID + ":" + "FingersPositioned + 0.1";
                }
                else
                {
                    list[i].StartCondition = list[i - 1].ID + ":" + mmiConstants.MSimulationEvent_End + "+ 0.1";
                }
            }
        }

        //Assign default idle
        CoSimulator.AssignInstruction(idleInstruction,
                                      new MSimulationState()
        {
            Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
        });

        //Assign instruction from list
        foreach (var t in list)
        {
            CoSimulator.AssignInstruction(t,
                                          new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }
    }
Example #12
0
    protected override void GUIBehaviorInput()
    {
        if (GUI.Button(new Rect(10, 10, 220, 50), "Pickup large object"))
        {
            MInstruction walkInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Walk", MOTION_WALK)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTargetLargeObject").ID)
            };

            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction reachLeft = new MInstruction(MInstructionFactory.GenerateID(), "reachLeft", MOTION_REACH)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["LargeObjectGraspL"].ID, "Hand", "Left"),
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction reachRight = new MInstruction(MInstructionFactory.GenerateID(), "reachRight", MOTION_REACH)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["LargeObjectGraspR"].ID, "Hand", "Right"),
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            carryID = MInstructionFactory.GenerateID();
            MInstruction carryInstruction = new MInstruction(carryID, "carry object", MOTION_CARRY)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["LargeObject"].ID, "Hand", "Both", "CarryDistance", 0.4f.ToString(), "CarryTarget", UnitySceneAccess.Instance["CarryTarget"].ID),
                StartCondition = reachLeft.ID + ":" + mmiConstants.MSimulationEvent_End + " && " + reachRight.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            this.CoSimulator.AssignInstruction(walkInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(idleInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(reachLeft, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(reachRight, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });

            this.CoSimulator.AssignInstruction(carryInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.MSimulationEventHandler += this.CoSimulator_MSimulationEventHandler;
        }

        if (GUI.Button(new Rect(240, 10, 220, 50), "Move Large Object both handed"))
        {
            MInstruction moveInstruction = new MInstruction(MInstructionFactory.GenerateID(), "move object", MOTION_MOVE)
            {
                Properties = PropertiesCreator.Create("SubjectID", UnitySceneAccess.Instance["LargeObject"].ID, "Hand", "Both", "TargetID", UnitySceneAccess.Instance["LargeObjectPositioningTarget"].ID, "HoldDuration", 1.0f.ToString()),

                //Terminate the carry
                Action = CoSimTopic.OnStart + "->" + carryID + ":" + CoSimAction.EndInstruction,
            };

            MInstruction releaseLeft = new MInstruction(MInstructionFactory.GenerateID(), "release object left", MOTION_RELEASE)
            {
                Properties     = PropertiesCreator.Create("Hand", "Left"),
                StartCondition = moveInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction releaseRight = new MInstruction(MInstructionFactory.GenerateID(), "release object right", MOTION_RELEASE)
            {
                Properties     = PropertiesCreator.Create("Hand", "Right"),
                StartCondition = moveInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            this.CoSimulator.AssignInstruction(moveInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(releaseLeft, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(releaseRight, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }

        if (GUI.Button(new Rect(470, 10, 220, 50), "Carry Object both handed"))
        {
            carryID = MInstructionFactory.GenerateID();
            MInstruction carryInstruction = new MInstruction(carryID, "carry object", MOTION_CARRY)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Both", "CarryTarget", UnitySceneAccess.Instance["CarryTarget"].ID),
            };

            this.CoSimulator.AssignInstruction(carryInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }
        // if (GUI.Button(new Rect(920, 70, 160, 50), "Abort"))
        // {
        //     this.CoSimulator.Abort();
        // }
    }
        public override MSimulationResult DoStep(double time, MSimulationState simulationState)
        {
            //Set the position of the move target
            this.SkeletonAccess.SetChannelData(simulationState.Current);
            this.moveTarget.Transform.Position = this.SkeletonAccess.GetGlobalJointPosition(simulationState.Current.AvatarID, MJointType.RightWrist);


            //Update the scene objects within the virtual scene
            this.virtualScene.Apply(new MSceneUpdate()
            {
                //Add the changed objects
                ChangedSceneObjects = new List <MSceneObjectUpdate>()
                {
                    //Add the move target (just existing in the local co-simulation)
                    new MSceneObjectUpdate()
                    {
                        ID        = this.moveTarget.ID,
                        Transform = new MTransformUpdate()
                        {
                            Position = this.moveTarget.Transform.Position.GetValues(),
                            Rotation = this.moveTarget.Transform.Rotation.GetValues()
                        }
                    },
                    //Add the carry object (externally modified)
                    new MSceneObjectUpdate()
                    {
                        ID        = this.carryObject.ID,
                        Transform = new MTransformUpdate()
                        {
                            Position = this.carryObject.Transform.Position.GetValues(),
                            Rotation = this.carryObject.Transform.Rotation.GetValues()
                        }
                    },
                }
            });


            //Transmit the  virtual scene (if first frame-> transmit full scene otherwise just deltas)
            this.mmuAccess.PushScene(this.transmitFullScene);

            //Full transmission only required at first frame
            this.transmitFullScene = false;

            //Execute the co-simulation
            MSimulationResult result = this.coSimulator.DoStep(time, simulationState);

            //Check if the present instruction is finished
            if (result.Events != null && result.Events.Count > 0)
            {
                if (result.Events.Exists(s => s.Reference == this.currentInstructionID && s.Type == mmiConstants.MSimulationEvent_End))
                {
                    //Create a new id for the instruction
                    this.currentInstructionID = MInstructionFactory.GenerateID();

                    //Create a new subinstruction utilizing the  moving target
                    MInstruction subInstruction = new MInstruction(currentInstructionID, "NestedMove", "move")
                    {
                        Properties = PropertiesCreator.Create("TargetID", moveTarget.ID, "SubjectID", instruction.Properties["TargetID"], "Hand", instruction.Properties["Hand"])
                    };

                    //Assign the new instruction to the co-simulator
                    this.coSimulator.AssignInstruction(subInstruction, simulationState);
                }
            }

            return(result);
        }
 /// <summary>
 /// Basic constructor
 /// </summary>
 public CoSimulationMMUImpl()
 {
     this.Name      = "CoSimulation";
     this.sessionId = this.Name + MInstructionFactory.GenerateID();
 }
Example #15
0
        /// <summary>
        ///     Reach selected object
        /// </summary>
        public void ReachObject()
        {
            GameObject go;

            try
            {
                //Get selected object
                go = selectObject.GetObject();
            }
            catch (NullReferenceException)
            {
                SSTools.ShowMessage("No object selected", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }

            //If move target is selected, switch to parent
            if (MoveTargetChecker.IsMoveTarget(go))
            {
                go = go.transform.parent.gameObject;
            }

            //Check for hands
            if (!HandChecker.HasHands(go))
            {
                SSTools.ShowMessage("No hands placed", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }

            //List of instructions
            List <MInstruction> list = new List <MInstruction>();

            if (HandChecker.HasLeftHand(go))
            {
                //Get UnitySceneAccess ID of hand
                //GameObject hand = go.transform.Find("LeftHand(Clone)").gameObject;
                GameObject hand     = HandChecker.GetLeftHand(go);
                String     objectID = hand.GetComponent <MMISceneObject>().MSceneObject.ID;

                //Now create a specific instruction to reach with the right hand
                MInstruction reachLeft = new MInstruction(MInstructionFactory.GenerateID(), "reach left", "Pose/Reach")
                {
                    Properties = PropertiesCreator.Create("TargetID", objectID,
                                                          "Hand", "Left")
                };

                //Add instructions to list
                list.Add(reachLeft);
                list.AddRange(MakeHandPose(go, "Left"));
            }

            if (HandChecker.HasRightHand(go))
            {
                //Get UnitySceneAccess ID of hand
                //GameObject hand = go.transform.Find("RightHand(Clone)").gameObject;
                GameObject hand     = HandChecker.GetRightHand(go);
                String     objectID = hand.GetComponent <MMISceneObject>().MSceneObject.ID;
                //Now create a specific instruction to reach with the right hand
                MInstruction reachRight = new MInstruction(MInstructionFactory.GenerateID(), "reach right", "Pose/Reach")
                {
                    Properties = PropertiesCreator.Create("TargetID", objectID, "Hand", "Right")
                };

                //Add instructions to list
                list.Add(reachRight);
                list.AddRange(MakeHandPose(go, "Right"));
            }

            //Add instruction to queue
            queueController.AddItem(list, "Reach " + go.name);
        }
Example #16
0
        /// <summary>
        ///     Release selected object
        /// </summary>
        public void Release()
        {
            if (!pickedUp)
            {
                GameObject go;
                try
                {
                    //Get selected object
                    go = selectObject.GetObject();
                }
                catch (NullReferenceException)
                {
                    SSTools.ShowMessage("No object selected", SSTools.Position.bottom, SSTools.Time.twoSecond);
                    return;
                }

                //If move target is selected, switch to parent
                if (MoveTargetChecker.IsMoveTarget(go))
                {
                    go = go.transform.parent.gameObject;
                }

                //List for instructions
                List <MInstruction> list = new List <MInstruction>();

                //List for hands on object
                List <GameObject> hands = new List <GameObject>();

                if (HandChecker.HasLeftHand(go))
                {
                    MInstruction releaseLeft =
                        new MInstruction(MInstructionFactory.GenerateID(), "release object", "Object/Release")
                    {
                        Properties = PropertiesCreator.Create("Hand", "Left", CoSimTopic.OnStart,
                                                              _handPoseIdManager.CurrentHandIdLeft + ":" + CoSimAction.EndInstruction)
                                     //Properties = PropertiesCreator.Create("Hand", "Left")
                    };

                    //Add instructions to position fingers
                    list.AddRange(ReleaseHandPose("Left"));

                    //Add instruction to release left hand
                    list.Add(releaseLeft);

                    //Remove left hand game object from object
                    //hands.Add(go.transform.Find("LeftHand(Clone)").gameObject);
                    hands.Add(HandChecker.GetLeftHand(go));
                }


                if (HandChecker.HasRightHand(go))
                {
                    MInstruction releaseRight =
                        new MInstruction(MInstructionFactory.GenerateID(), "release object", "Object/Release")
                    {
                        Properties = PropertiesCreator.Create("Hand", "Right", CoSimTopic.OnStart,
                                                              _handPoseIdManager.CurrentHandIdRight + ":" + CoSimAction.EndInstruction)
                                     //Properties = PropertiesCreator.Create("Hand", "Right")
                    };

                    //Add instructions to position fingers
                    list.AddRange(ReleaseHandPose("Right"));

                    //Add instruction to release right hand
                    list.Add(releaseRight);

                    //Remove right hand game object from object
                    //hands.Add(go.transform.Find("RightHand(Clone)").gameObject);
                    hands.Add(HandChecker.GetRightHand(go));
                }

                //Destroy the hands after moving an object
                foreach (var hand in hands)
                {
                    Destroy(hand);
                }

                //Add instructions to queue
                queueController.AddItem(list, "Release " + go.name);
            }
            else
            {
                SSTools.ShowMessage("Object needs to be moved first!", SSTools.Position.bottom, SSTools.Time.twoSecond);
            }
        }
Example #17
0
    protected override void GUIBehaviorInput()
    {
        if (GUI.Button(new Rect(10, 10, 120, buttonHeight), "Idle"))
        {
            MSkeletonAccess.Iface skeletonAccess = this.avatar.GetSkeletonAccess();
            skeletonAccess.SetChannelData(this.avatar.GetPosture());



            MInstruction instruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE);
            //MInstruction instruction = new MInstruction(MInstructionFactory.GenerateID(), "MMUTest", "Object/Move");
            MSimulationState simstate = new MSimulationState(this.avatar.GetPosture(), this.avatar.GetPosture());



            this.CoSimulator.Abort();
            this.CoSimulator.AssignInstruction(instruction, simstate);
        }


        if (GUI.Button(new Rect(140, 10, 120, buttonHeight), "Walk to"))
        {
            MInstruction walkInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Walk", MOTION_WALK)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTarget").ID)
            };

            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                //Start idle after walk has been finished
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End //synchronization constraint similar to bml "id:End"  (bml original: <bml start="id:End"/>
            };

            this.CoSimulator.Abort();


            MSimulationState currentState = new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            };

            //Assign walk and idle instruction
            this.CoSimulator.AssignInstruction(walkInstruction, currentState);
            this.CoSimulator.AssignInstruction(idleInstruction, currentState);
            this.CoSimulator.MSimulationEventHandler += this.CoSimulator_MSimulationEventHandler;
        }


        if (GUI.Button(new Rect(270, 10, 120, buttonHeight), "Reach Object"))
        {
            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE);


            MInstruction reachRight = new MInstruction(MInstructionFactory.GenerateID(), "reach right", MOTION_REACH)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTargetR"].ID, "Hand", "Right", "MinDistance", 2.0.ToString()),
            };


            //MInstruction reachLeft = new MInstruction(MInstructionFactory.GenerateID(), "reach left", "Pose/Reach")
            //{
            //    Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTargetL"].ID, "Hand", "Left"),
            //};

            //this.CoSimulator.Abort();
            this.CoSimulator.AssignInstruction(idleInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(reachRight, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            //this.CoSimulator.AssignInstruction(reachLeft, new MSimulationState() { Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture() });
        }


        if (GUI.Button(new Rect(400, 10, 120, buttonHeight), "Move Object"))
        {
            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE);

            MInstruction moveObject = new MInstruction(MInstructionFactory.GenerateID(), "move object", MOTION_MOVE)
            {
                Properties = PropertiesCreator.Create("SubjectID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Right", "TargetID", UnitySceneAccess.Instance["PositioningTarget"].ID),
            };

            this.CoSimulator.Abort();
            this.CoSimulator.AssignInstruction(idleInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(moveObject, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }


        if (GUI.Button(new Rect(530, 10, 120, buttonHeight), "Pick-up"))
        {
            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE);

            MInstruction reachInstruction = new MInstruction(MInstructionFactory.GenerateID(), "reach", MOTION_REACH)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTargetR"].ID, "Hand", "Right"),
            };

            carryID = MInstructionFactory.GenerateID();
            MInstruction carryInstruction = new MInstruction(carryID, "carry object", MOTION_CARRY)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Right"),
                StartCondition = reachInstruction.ID + ":" + mmiConstants.MSimulationEvent_End + "+ 0.01"
            };


            this.CoSimulator.AssignInstruction(idleInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(reachInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(carryInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.MSimulationEventHandler += this.CoSimulator_MSimulationEventHandler;
        }

        if (GUI.Button(new Rect(660, 10, 120, buttonHeight), "Carry Object"))
        {
            carryID = MInstructionFactory.GenerateID();
            MInstruction carryInstruction = new MInstruction(carryID, "carry object", MOTION_CARRY)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Right")//, "CarryTarget", UnitySceneAccess.Instance["CarryTarget"].ID),
            };

            this.CoSimulator.AssignInstruction(carryInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }



        if (GUI.Button(new Rect(790, 10, 120, buttonHeight), "Release Object"))
        {
            MInstruction releaseRight = new MInstruction(MInstructionFactory.GenerateID(), "release object", MOTION_RELEASE)
            {
                Properties = PropertiesCreator.Create("Hand", "Right", CoSimTopic.OnStart, carryID + ":" + CoSimAction.EndInstruction),
            };
            MInstruction releaseLeft = new MInstruction(MInstructionFactory.GenerateID(), "release object", MOTION_RELEASE)
            {
                Properties = PropertiesCreator.Create("Hand", "Left", CoSimTopic.OnStart, carryID + ":" + CoSimAction.EndInstruction),
            };


            this.CoSimulator.AssignInstruction(releaseRight, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(releaseLeft, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }


        if (GUI.Button(new Rect(10, 40, 160, buttonHeight), "Concurrent scenario"))
        {
            MInstruction walkInstruction1 = new MInstruction(MInstructionFactory.GenerateID(), "Walk", MOTION_WALK)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTargetConcurrent").ID),
            };

            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                StartCondition = walkInstruction1.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            MInstruction reachRight = new MInstruction(MInstructionFactory.GenerateID(), "reach right", MOTION_REACH)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTarget2R"].ID, "Hand", "Right"),
                StartCondition = walkInstruction1.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            MInstruction reachLeft = new MInstruction(MInstructionFactory.GenerateID(), "reach left", MOTION_REACH)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTargetL"].ID, "Hand", "Left"),
                StartCondition = walkInstruction1.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            MInstruction carryLeft = new MInstruction(MInstructionFactory.GenerateID(), "carry left", MOTION_CARRY)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Left", "AddOffset", false.ToString()),
                StartCondition = reachLeft.ID + ":" + mmiConstants.MSimulationEvent_End + "+ 0.01"
            };

            MInstruction carryRight = new MInstruction(MInstructionFactory.GenerateID(), "carry right", MOTION_CARRY)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject2"].ID, "Hand", "Right", "AddOffset", false.ToString()),
                StartCondition = reachRight.ID + ":" + mmiConstants.MSimulationEvent_End + "+ 0.01"
            };

            MInstruction walkInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Walk", MOTION_WALK)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTarget2").ID),
                //Both carries must me finished with positioning
                StartCondition = carryRight.ID + ":" + "PositioningFinished" + " && " + carryLeft.ID + ":" + "PositioningFinished",

                //Finish the idle instruction
                Action = CoSimTopic.OnStart + "->" + idleInstruction.ID + ":" + CoSimAction.EndInstruction,
            };



            MInstruction idleInstruction2 = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End,
            };


            MInstruction moveRight = new MInstruction(MInstructionFactory.GenerateID(), "move right", MOTION_MOVE)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["PositioningTargetRight"].ID, "SubjectID", UnitySceneAccess.Instance["GraspObject2"].ID, "Hand", "Right", CoSimTopic.OnStart, carryRight.ID + ":" + CoSimAction.EndInstruction),
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction moveLeft = new MInstruction(MInstructionFactory.GenerateID(), "move left", MOTION_MOVE)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["PositioningTargetLeft"].ID, "SubjectID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Left", CoSimTopic.OnStart, carryLeft.ID + ":" + CoSimAction.EndInstruction),
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction releaseRight = new MInstruction(MInstructionFactory.GenerateID(), "release right", MOTION_RELEASE)
            {
                Properties     = PropertiesCreator.Create("Hand", "Right"),
                StartCondition = moveRight.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction releaseLeft = new MInstruction(MInstructionFactory.GenerateID(), "release left", MOTION_RELEASE)
            {
                Properties     = PropertiesCreator.Create("Hand", "Left"),
                StartCondition = moveLeft.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            MInstruction walkInstruction2 = new MInstruction(MInstructionFactory.GenerateID(), "Walk2", MOTION_WALK)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTargetConcurrent").ID, CoSimTopic.OnStart, idleInstruction.ID + ":" + CoSimAction.EndInstruction),
                StartCondition = releaseLeft.ID + ":" + mmiConstants.MSimulationEvent_End// + "|" + releaseLeft.ID + ":" + mmiConstants.MSimulationEvent_End,
            };

            MInstruction idleInstruction3 = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                StartCondition = walkInstruction2.ID + ":" + mmiConstants.MSimulationEvent_End,
            };


            MInstruction reachRight2 = new MInstruction(MInstructionFactory.GenerateID(), "reach right", MOTION_REACH)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTarget3R"].ID, "Hand", "Right"),
                StartCondition = walkInstruction2.ID + ":" + mmiConstants.MSimulationEvent_End// + "|>" + releaseLeft.ID + ":" + mmiConstants.MSimulationEvent_End,
            };

            MInstruction carryRight2 = new MInstruction(MInstructionFactory.GenerateID(), "carry right", MOTION_CARRY)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject3"].ID, "Hand", "Right", "AddOffset", false.ToString()),
                StartCondition = reachRight2.ID + ":" + mmiConstants.MSimulationEvent_End + "+ 0.01"
            };


            MInstruction walkInstruction3 = new MInstruction(MInstructionFactory.GenerateID(), "Walk2", MOTION_WALK)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTarget2").ID, CoSimTopic.OnStart, idleInstruction3.ID + ":" + CoSimAction.EndInstruction),
                StartCondition = carryRight2.ID + ":" + "PositioningFinished"// + "|" + releaseLeft.ID + ":" + mmiConstants.MSimulationEvent_End,
            };

            MInstruction idleInstruction4 = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                StartCondition = walkInstruction3.ID + ":" + mmiConstants.MSimulationEvent_End,
            };

            MSimulationState state = new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            };

            this.CoSimulator.Abort();
            this.CoSimulator.AssignInstruction(walkInstruction1, state);
            this.CoSimulator.AssignInstruction(idleInstruction, state);
            this.CoSimulator.AssignInstruction(reachRight, state);
            this.CoSimulator.AssignInstruction(reachLeft, state);
            this.CoSimulator.AssignInstruction(carryRight, state);
            this.CoSimulator.AssignInstruction(carryLeft, state);
            this.CoSimulator.AssignInstruction(walkInstruction, state);
            this.CoSimulator.AssignInstruction(idleInstruction2, state);
            this.CoSimulator.AssignInstruction(moveRight, state);
            this.CoSimulator.AssignInstruction(moveLeft, state);
            this.CoSimulator.AssignInstruction(releaseLeft, state);
            this.CoSimulator.AssignInstruction(releaseRight, state);
            this.CoSimulator.AssignInstruction(walkInstruction2, state);
            this.CoSimulator.AssignInstruction(idleInstruction3, state);
            this.CoSimulator.AssignInstruction(reachRight2, state);
            this.CoSimulator.AssignInstruction(carryRight2, state);
            this.CoSimulator.AssignInstruction(walkInstruction3, state);
            this.CoSimulator.AssignInstruction(idleInstruction4, state);
        }


        if (GUI.Button(new Rect(10, 70, 220, buttonHeight), "Pickup large object"))
        {
            MInstruction walkInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Walk", MOTION_WALK)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTargetLargeObject").ID)
            };

            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction reachLeft = new MInstruction(MInstructionFactory.GenerateID(), "reachLeft", MOTION_REACH)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["LargeObjectGraspL"].ID, "Hand", "Left"),
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction reachRight = new MInstruction(MInstructionFactory.GenerateID(), "reachRight", MOTION_REACH)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["LargeObjectGraspR"].ID, "Hand", "Right"),
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            carryID = MInstructionFactory.GenerateID();
            MInstruction carryInstruction = new MInstruction(carryID, "carry object", MOTION_CARRY)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["LargeObject"].ID, "Hand", "Both", "CarryDistance", 0.4f.ToString(), "CarryTarget", UnitySceneAccess.Instance["CarryTarget"].ID),
                StartCondition = reachLeft.ID + ":" + mmiConstants.MSimulationEvent_End + " && " + reachRight.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            this.CoSimulator.AssignInstruction(walkInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(idleInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(reachLeft, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(reachRight, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });

            this.CoSimulator.AssignInstruction(carryInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.MSimulationEventHandler += this.CoSimulator_MSimulationEventHandler;
        }

        if (GUI.Button(new Rect(240, 70, 220, buttonHeight), "Move Large Object both handed"))
        {
            MInstruction moveInstruction = new MInstruction(MInstructionFactory.GenerateID(), "move object", MOTION_MOVE)
            {
                Properties = PropertiesCreator.Create("SubjectID", UnitySceneAccess.Instance["LargeObject"].ID, "Hand", "Both", "TargetID", UnitySceneAccess.Instance["LargeObjectPositioningTarget"].ID, "HoldDuration", 1.0f.ToString()),

                //Terminate the carry
                Action = CoSimTopic.OnStart + "->" + carryID + ":" + CoSimAction.EndInstruction,
            };

            MInstruction releaseLeft = new MInstruction(MInstructionFactory.GenerateID(), "release object left", MOTION_RELEASE)
            {
                Properties     = PropertiesCreator.Create("Hand", "Left"),
                StartCondition = moveInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction releaseRight = new MInstruction(MInstructionFactory.GenerateID(), "release object right", MOTION_RELEASE)
            {
                Properties     = PropertiesCreator.Create("Hand", "Right"),
                StartCondition = moveInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            this.CoSimulator.AssignInstruction(moveInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(releaseLeft, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(releaseRight, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }

        if (GUI.Button(new Rect(470, 70, 220, buttonHeight), "Carry Object both handed"))
        {
            carryID = MInstructionFactory.GenerateID();
            MInstruction carryInstruction = new MInstruction(carryID, "carry object", MOTION_CARRY)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Both", "CarryTarget", UnitySceneAccess.Instance["CarryTarget"].ID),
            };

            this.CoSimulator.AssignInstruction(carryInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }

        if (GUI.Button(new Rect(700, 70, 210, buttonHeight), "Reach Object Single"))
        {
            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE);


            MInstruction reachRight = new MInstruction(MInstructionFactory.GenerateID(), "reach right", MOTION_REACH)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTargetR"].ID, "Hand", "Right"),
            };



            this.CoSimulator.Abort();
            this.CoSimulator.AssignInstruction(idleInstruction, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
            this.CoSimulator.AssignInstruction(reachRight, new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            });
        }

        if (GUI.Button(new Rect(180, 40, 160, buttonHeight), "Abort"))
        {
            this.CoSimulator.Abort();
        }
    }
Example #18
0
        /// <summary>
        ///     Pick up selected object
        /// </summary>
        public void PickUp()
        {
            GameObject obj;

            try
            {
                //Get selected object
                obj = selectObject.GetObject();
            }
            catch (NullReferenceException)
            {
                SSTools.ShowMessage("No object selected", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }

            //If move target is selected, switch to parent
            if (MoveTargetChecker.IsMoveTarget(obj))
            {
                obj = obj.transform.parent.gameObject;
            }

            if (!HandChecker.HasHands(obj))
            {
                SSTools.ShowMessage("No hands placed", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }

            List <MInstruction> list = new List <MInstruction>();

            //Get IDs of object
            String objID = obj.GetComponent <MMISceneObject>().MSceneObject.ID;

            //Instructions if both hands are present on object
            if (HandChecker.HasBothHands(obj))
            {
                _carryIDManager.CurrentCarryIdBoth = MInstructionFactory.GenerateID();
                MInstruction carryInstruction =
                    new MInstruction(_carryIDManager.CurrentCarryIdBoth, "carry object", "Object/Carry")
                {
                    Properties = PropertiesCreator.Create("TargetID", objID, "Hand",
                                                          "Both")
                };
                list.Add(carryInstruction);
            }

            //Instructions if only right hand is present on object
            else if (HandChecker.HasRightHand(obj))
            {
                _carryIDManager.CurrentCarryIdRight = MInstructionFactory.GenerateID();
                MInstruction carryInstruction =
                    new MInstruction(_carryIDManager.CurrentCarryIdRight, "carry object", "Object/Carry")
                {
                    Properties = PropertiesCreator.Create("TargetID", objID, "Hand",
                                                          "Right"),
                };
                list.Add(carryInstruction);
            }

            //Instructions if only left hand is present on object
            else if (HandChecker.HasLeftHand(obj))
            {
                _carryIDManager.CurrentCarryIdLeft = MInstructionFactory.GenerateID();
                MInstruction carryInstruction =
                    new MInstruction(_carryIDManager.CurrentCarryIdLeft, "carry object", "Object/Carry")
                {
                    Properties = PropertiesCreator.Create("TargetID", objID, "Hand",
                                                          "Left"),
                };
                list.Add(carryInstruction);
            }
            //Indicates that an object has been picked up, so it cannot be released
            pickedUp = true;

            //Add instructions to queue
            queueController.AddItem(list, "Pick up " + obj.name);
        }
Example #19
0
    private void OnGUI()
    {
        if (GUI.Button(new Rect(300, 200, 200, 100), "Grasp object (trajectory)"))
        {
            MPathConstraint pathConstraint = new MPathConstraint()
            {
                PolygonPoints = new List <MGeometryConstraint>()
            };

            foreach (Transform transform in this.TrajectoryPoints)
            {
                MVector3 position      = transform.position.ToMVector3();
                MVector3 rotationEuler = transform.rotation.eulerAngles.ToMVector3();


                pathConstraint.PolygonPoints.Add(new MGeometryConstraint("")
                {
                    TranslationConstraint = new MTranslationConstraint()
                    {
                        Type   = MTranslationConstraintType.BOX,
                        Limits = position.ToMInterval3(this.TranslationTolerance)
                    },
                    RotationConstraint = new MRotationConstraint()
                    {
                        Limits = rotationEuler.ToMInterval3(this.RotationTolerance)
                    }
                });
            }

            MConstraint moveConstraint = new MConstraint(System.Guid.NewGuid().ToString())
            {
                PathConstraint = pathConstraint
            };

            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", "idle");

            MInstruction reachRight = new MInstruction(MInstructionFactory.GenerateID(), "reach right", "Pose/Reach")
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTargetR"].ID, "Hand", "Right", "MinDistance", 2.0.ToString()),
            };

            MInstruction moveRight = new MInstruction(MInstructionFactory.GenerateID(), "move right", "Object/Move")
            {
                Properties = new Dictionary <string, string>()
                {
                    { "SubjectID", this.GetComponent <MMISceneObject>().MSceneObject.ID },
                    { "Hand", "Right" },
                    { "MinDistance", 2.0.ToString() },
                    { "trajectory", moveConstraint.ID }
                },
                StartCondition = reachRight.ID + ":" + mmiConstants.MSimulationEvent_End,
                Constraints    = new List <MConstraint>()
                {
                    moveConstraint
                }
            };

            MMIAvatar avatar = GameObject.FindObjectOfType <MMIAvatar>();

            //this.CoSimulator.Abort();
            avatar.CoSimulator.AssignInstruction(idleInstruction, new MSimulationState()
            {
                Initial = avatar.GetPosture(), Current = avatar.GetPosture()
            });
            avatar.CoSimulator.AssignInstruction(reachRight, new MSimulationState()
            {
                Initial = avatar.GetPosture(), Current = avatar.GetPosture()
            });
            avatar.CoSimulator.AssignInstruction(moveRight, new MSimulationState()
            {
                Initial = avatar.GetPosture(), Current = avatar.GetPosture()
            });
        }
    }
Example #20
0
 /// <summary>
 /// Basic constructor
 /// </summary>
 public NestedMMUBase()
 {
     this.Name      = "CoSimulation";
     this.sessionId = this.Name + MInstructionFactory.GenerateID();
 }
Example #21
0
    protected override void GUIBehaviorInput()
    {
        if (GUI.Button(new Rect(10, 10, 160, 50), "Concurrent scenario"))
        {
            MInstruction walkInstruction1 = new MInstruction(MInstructionFactory.GenerateID(), "Walk", MOTION_WALK)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTargetConcurrent").ID),
            };

            MInstruction idleInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                StartCondition = walkInstruction1.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            MInstruction reachRight = new MInstruction(MInstructionFactory.GenerateID(), "reach right", MOTION_REACH)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTarget2R"].ID, "Hand", "Right"),
                StartCondition = walkInstruction1.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            MInstruction reachLeft = new MInstruction(MInstructionFactory.GenerateID(), "reach left", MOTION_REACH)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTargetL"].ID, "Hand", "Left"),
                StartCondition = walkInstruction1.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            MInstruction carryLeft = new MInstruction(MInstructionFactory.GenerateID(), "carry left", MOTION_CARRY)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Left", "AddOffset", false.ToString()),
                StartCondition = reachLeft.ID + ":" + mmiConstants.MSimulationEvent_End + "+ 0.01"
            };

            MInstruction carryRight = new MInstruction(MInstructionFactory.GenerateID(), "carry right", MOTION_CARRY)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject2"].ID, "Hand", "Right", "AddOffset", false.ToString()),
                StartCondition = reachRight.ID + ":" + mmiConstants.MSimulationEvent_End + "+ 0.01"
            };

            MInstruction walkInstruction = new MInstruction(MInstructionFactory.GenerateID(), "Walk", MOTION_WALK)
            {
                Properties = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTarget2").ID),
                //Both carries must me finished with positioning
                StartCondition = carryRight.ID + ":" + "PositioningFinished" + " && " + carryLeft.ID + ":" + "PositioningFinished",

                //Finish the idle instruction
                Action = CoSimTopic.OnStart + "->" + idleInstruction.ID + ":" + CoSimAction.EndInstruction,
            };



            MInstruction idleInstruction2 = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End,
            };


            MInstruction moveRight = new MInstruction(MInstructionFactory.GenerateID(), "move right", MOTION_MOVE)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["PositioningTargetRight"].ID, "SubjectID", UnitySceneAccess.Instance["GraspObject2"].ID, "Hand", "Right", CoSimTopic.OnStart, carryRight.ID + ":" + CoSimAction.EndInstruction),
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction moveLeft = new MInstruction(MInstructionFactory.GenerateID(), "move left", MOTION_MOVE)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["PositioningTargetLeft"].ID, "SubjectID", UnitySceneAccess.Instance["GraspObject"].ID, "Hand", "Left", CoSimTopic.OnStart, carryLeft.ID + ":" + CoSimAction.EndInstruction),
                StartCondition = walkInstruction.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction releaseRight = new MInstruction(MInstructionFactory.GenerateID(), "release right", MOTION_RELEASE)
            {
                Properties     = PropertiesCreator.Create("Hand", "Right"),
                StartCondition = moveRight.ID + ":" + mmiConstants.MSimulationEvent_End
            };

            MInstruction releaseLeft = new MInstruction(MInstructionFactory.GenerateID(), "release left", MOTION_RELEASE)
            {
                Properties     = PropertiesCreator.Create("Hand", "Left"),
                StartCondition = moveLeft.ID + ":" + mmiConstants.MSimulationEvent_End
            };


            MInstruction walkInstruction2 = new MInstruction(MInstructionFactory.GenerateID(), "Walk2", MOTION_WALK)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTargetConcurrent").ID, CoSimTopic.OnStart, idleInstruction.ID + ":" + CoSimAction.EndInstruction),
                StartCondition = releaseLeft.ID + ":" + mmiConstants.MSimulationEvent_End// + "|" + releaseLeft.ID + ":" + mmiConstants.MSimulationEvent_End,
            };

            MInstruction idleInstruction3 = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                StartCondition = walkInstruction2.ID + ":" + mmiConstants.MSimulationEvent_End,
            };


            MInstruction reachRight2 = new MInstruction(MInstructionFactory.GenerateID(), "reach right", MOTION_REACH)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspTarget3R"].ID, "Hand", "Right"),
                StartCondition = walkInstruction2.ID + ":" + mmiConstants.MSimulationEvent_End// + "|>" + releaseLeft.ID + ":" + mmiConstants.MSimulationEvent_End,
            };

            MInstruction carryRight2 = new MInstruction(MInstructionFactory.GenerateID(), "carry right", MOTION_CARRY)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance["GraspObject3"].ID, "Hand", "Right", "AddOffset", false.ToString()),
                StartCondition = reachRight2.ID + ":" + mmiConstants.MSimulationEvent_End + "+ 0.01"
            };


            MInstruction walkInstruction3 = new MInstruction(MInstructionFactory.GenerateID(), "Walk2", MOTION_WALK)
            {
                Properties     = PropertiesCreator.Create("TargetID", UnitySceneAccess.Instance.GetSceneObjectByName("WalkTarget2").ID, CoSimTopic.OnStart, idleInstruction3.ID + ":" + CoSimAction.EndInstruction),
                StartCondition = carryRight2.ID + ":" + "PositioningFinished"// + "|" + releaseLeft.ID + ":" + mmiConstants.MSimulationEvent_End,
            };

            MInstruction idleInstruction4 = new MInstruction(MInstructionFactory.GenerateID(), "Idle", MOTION_IDLE)
            {
                StartCondition = walkInstruction3.ID + ":" + mmiConstants.MSimulationEvent_End,
            };

            MSimulationState state = new MSimulationState()
            {
                Initial = this.avatar.GetPosture(), Current = this.avatar.GetPosture()
            };

            this.CoSimulator.Abort();
            this.CoSimulator.AssignInstruction(walkInstruction1, state);
            this.CoSimulator.AssignInstruction(idleInstruction, state);
            this.CoSimulator.AssignInstruction(reachRight, state);
            this.CoSimulator.AssignInstruction(reachLeft, state);
            this.CoSimulator.AssignInstruction(carryRight, state);
            this.CoSimulator.AssignInstruction(carryLeft, state);
            this.CoSimulator.AssignInstruction(walkInstruction, state);
            this.CoSimulator.AssignInstruction(idleInstruction2, state);
            this.CoSimulator.AssignInstruction(moveRight, state);
            this.CoSimulator.AssignInstruction(moveLeft, state);
            this.CoSimulator.AssignInstruction(releaseLeft, state);
            this.CoSimulator.AssignInstruction(releaseRight, state);
            this.CoSimulator.AssignInstruction(walkInstruction2, state);
            this.CoSimulator.AssignInstruction(idleInstruction3, state);
            this.CoSimulator.AssignInstruction(reachRight2, state);
            this.CoSimulator.AssignInstruction(carryRight2, state);
            this.CoSimulator.AssignInstruction(walkInstruction3, state);
            this.CoSimulator.AssignInstruction(idleInstruction4, state);
        }
    }