Beispiel #1
0
        private void GetGameObjects(EnvironmentInfo environmentInfo, GameObject avatarMotionPlayback, GameObject worldPlayback)
        {
            this.robot = GameObject.FindGameObjectWithTag(TagRobot);

            this.hsrGraspingDetector = this.robot.GetComponentInChildren <GraspingDetector>();

            // Get grasping candidates
            List <GameObject> graspingCandidates = ExtractGraspingCandidates(environmentInfo);

//			List<GameObject> dummyGraspingCandidates = GameObject.FindGameObjectsWithTag(TagDummyGraspingCandidates).ToList<GameObject>();

            this.graspables = new List <GameObject>();

            this.graspables.AddRange(graspingCandidates);
//			this.graspables.AddRange(dummyGraspingCandidates);

            // Check the name conflict of graspables.
            if (this.graspables.Count != (from graspable in this.graspables select graspable.name).Distinct().Count())
            {
                throw new Exception("There is the name conflict of graspable objects.");
            }

            SIGVerseLogger.Info("Count of Graspables   = " + this.graspables.Count);

            // Get grasping candidates positions
            this.graspingCandidatesPositions = GameObject.FindGameObjectsWithTag(TagGraspingCandidatesPosition).ToList <GameObject>();

            if (graspables.Count > this.graspingCandidatesPositions.Count)
            {
                throw new Exception("graspables.Count > graspingCandidatesPositions.Count.");
            }
            else
            {
                SIGVerseLogger.Info("Count of GraspingCandidatesPosition = " + this.graspingCandidatesPositions.Count);
            }

            this.destinationCandidates = GameObject.FindGameObjectsWithTag(TagDestinationCandidates).ToList <GameObject>();

            if (this.destinationCandidates.Count == 0)
            {
                throw new Exception("Count of DestinationCandidates is zero.");
            }

            // Check the name conflict of destination candidates.
            if (this.destinationCandidates.Count != (from destinations in this.destinationCandidates select destinations.name).Distinct().Count())
            {
                throw new Exception("There is the name conflict of destination candidates objects.");
            }

            SIGVerseLogger.Info("Count of Destinations = " + this.destinationCandidates.Count);

            this.avatarMotionPlayer   = avatarMotionPlayback.GetComponent <CleanupAvatarMotionPlayer>();
            this.avatarMotionRecorder = avatarMotionPlayback.GetComponent <CleanupAvatarMotionRecorder>();

            this.playbackRecorder = worldPlayback.GetComponent <CleanupPlaybackRecorder>();
        }
        protected void Awake()
        {
            this.collisionEffect = (GameObject)Resources.Load(SIGVerseUtils.CollisionEffectPath);

            GameObject robot = GameObject.FindGameObjectWithTag(TagRobot);

            this.hsrBaseColliders = new List <Collider>();
            this.hsrBaseColliders.AddRange(SIGVerseUtils.FindTransformFromChild(robot.transform.root, HSRCommon.BaseName).GetComponentsInChildren <Collider>());
            this.hsrBaseColliders.AddRange(SIGVerseUtils.FindTransformFromChild(robot.transform.root, HSRCommon.BumperName).GetComponentsInChildren <Collider>());

            this.hsrHandColliders = new List <Collider>();
            this.hsrHandColliders.AddRange(SIGVerseUtils.FindTransformFromChild(robot.transform.root, Link.wrist_roll_link.ToString()).GetComponentsInChildren <Collider>());

            this.hsrGraspingDetector = robot.GetComponent <GraspingDetector>();
        }
        private void GetGameObjects(EnvironmentInfo environmentInfo, GameObject avatarMotionPlayback, GameObject worldPlayback)
        {
            this.robot = GameObject.FindGameObjectWithTag(TagRobot);

            this.hsrBaseFootPrint    = SIGVerseUtils.FindTransformFromChild(this.robot.transform, HSRCommon.Link.base_footprint.ToString());
            this.hsrGraspingDetector = this.robot.GetComponentInChildren <GraspingDetector>();


            GameObject moderatorObj = GameObject.FindGameObjectWithTag(TagModerator);

            // Get grasping candidates
            this.graspingCandidates = this.ExtractGraspingCandidates(environmentInfo);

//			List<GameObject> dummyGraspingCandidates = GameObject.FindGameObjectsWithTag(TagDummyGraspingCandidates).ToList<GameObject>();

            this.graspables = new List <GameObject>();

            this.graspables.AddRange(this.graspingCandidates);
//			this.graspables.AddRange(dummyGraspingCandidates);

            // Check the name conflict of graspables.
            if (this.graspables.Count != (from graspable in this.graspables select graspable.name).Distinct().Count())
            {
                throw new Exception("There is the name conflict of graspable objects.");
            }

            SIGVerseLogger.Info("Count of Graspables = " + this.graspables.Count);


            this.bedRoomArea = GameObject.Find(this.environmentName + "/RoomArea/" + AreaNameBedRoom);
            this.kitchenArea = GameObject.Find(this.environmentName + "/RoomArea/" + AreaNameKitchen);
            this.livingArea  = GameObject.Find(this.environmentName + "/RoomArea/" + AreaNameLiving);
            this.lobbyArea   = GameObject.Find(this.environmentName + "/RoomArea/" + AreaNameLobby);

            // Get grasping candidates positions
            this.graspingCandidatesPositions = GameObject.FindGameObjectsWithTag(TagGraspingCandidatesPosition).ToList <GameObject>();

            if (this.graspables.Count > this.graspingCandidatesPositions.Count)
            {
                throw new Exception("graspables.Count > graspingCandidatesPositions.Count.");
            }
            else
            {
                SIGVerseLogger.Info("Count of GraspingCandidatesPosition = " + this.graspingCandidatesPositions.Count);
            }


            this.destinationCandidates = GameObject.FindGameObjectsWithTag(TagDestinationCandidates).ToList <GameObject>();

            this.destinationCandidates.Add(moderatorObj);             // Treat moderator as a destination candidate

            if (this.destinationCandidates.Count == 0)
            {
                throw new Exception("Count of DestinationCandidates is zero.");
            }

            // Check the name conflict of destination candidates.
            if (this.destinationCandidates.Count != (from destinations in this.destinationCandidates select destinations.name).Distinct().Count())
            {
                throw new Exception("There is the name conflict of destination candidates objects.");
            }

            SIGVerseLogger.Info("Count of Destinations = " + this.destinationCandidates.Count);

            this.avatarMotionPlayer   = avatarMotionPlayback.GetComponent <HandymanAvatarMotionPlayer>();
            this.avatarMotionRecorder = avatarMotionPlayback.GetComponent <HandymanAvatarMotionRecorder>();

            this.playbackRecorder = worldPlayback.GetComponent <HandymanPlaybackRecorder>();
            this.playbackRecorder.SetEnvironmentName(this.environmentName);
        }