/* © Siemens AG, 2018 Author: Suzannah Smith (suzannah.smith@siemens.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using UnityEngine; namespace RosSharp.Urdf { public enum GeometryTypes { Box, Cylinder, Sphere, Mesh } public class UrdfRobot : MonoBehaviour { public string FilePath; #region Configure Robot public void SetCollidersConvex(bool convex) { foreach (MeshCollider meshCollider in GetComponentsInChildren()) meshCollider.convex = convex; } public void SetRigidbodiesIsKinematic(bool isKinematic) { foreach (Rigidbody rb in GetComponentsInChildren()) rb.isKinematic = isKinematic; } public void SetUseUrdfInertiaData(bool useUrdfData) { foreach (UrdfInertial urdfInertial in GetComponentsInChildren()) urdfInertial.rigidbodyDataSource = useUrdfData ? UrdfInertial.RigidbodyDataSource.Urdf : UrdfInertial.RigidbodyDataSource.Unity; } public void SetRigidbodiesUseGravity(bool useGravity) { foreach (Rigidbody rb in GetComponentsInChildren()) rb.useGravity = useGravity; } public void GenerateUniqueJointNames() { foreach (UrdfJoint urdfJoint in GetComponentsInChildren()) urdfJoint.GenerateUniqueJointName(); } #endregion } }