Beispiel #1
0
        /// <summary>
        ///  Construct a new PhysicsBodySensor
        /// </summary>
        /// <param name="rootBody"></param>
        /// <param name="settings"></param>
        /// <param name="sensorName"></param>
        public PhysicsBodySensor(Rigidbody rootBody, GameObject rootGameObject, PhysicsSensorSettings settings, string sensorName = null)
        {
            m_PoseExtractor = new RigidBodyPoseExtractor(rootBody, rootGameObject);
            m_SensorName    = string.IsNullOrEmpty(sensorName) ? $"PhysicsBodySensor:{rootBody?.name}" : sensorName;
            m_Settings      = settings;

            var numTransformObservations = settings.TransformSize(m_PoseExtractor.NumPoses);

            m_Shape = new[] { numTransformObservations };
        }
Beispiel #2
0
        public PhysicsBodySensor(ArticulationBody rootBody, PhysicsSensorSettings settings, string sensorName = null)
        {
            m_PoseExtractor = new ArticulationBodyPoseExtractor(rootBody);
            m_SensorName    = string.IsNullOrEmpty(sensorName) ? $"ArticulationBodySensor:{rootBody?.name}" : sensorName;
            m_Settings      = settings;

            var numTransformObservations = settings.TransformSize(m_PoseExtractor.NumPoses);

            m_Shape = new[] { numTransformObservations };
        }
        /// <inheritdoc/>
        public override int[] GetObservationShape()
        {
            if (RootBody == null)
            {
                return(new[] { 0 });
            }

            // TODO static method in PhysicsBodySensor?
            // TODO only update PoseExtractor when body changes?
            var poseExtractor            = new ArticulationBodyPoseExtractor(RootBody);
            var numTransformObservations = Settings.TransformSize(poseExtractor.NumPoses);

            return(new[] { numTransformObservations });
        }