public override void OnInspectorGUI() { jointStatePatcher = (JointStatePatcher)target; DrawDefaultInspector(); if (GUILayout.Button("apply JointStateManagers")) { jointStatePatcher.patch(); } Application.runInBackground = true; }
private void TeleoperationPatcher() { GameObject robot = GameObject.Find(urdfImporter.robotName); if (robot != null) { SpotLightPatcher.patch(robot); KinematicPatcher.patch(robot); OdometryPatcher.patch(robot); JointStatePatcher.patch(robot); var rosConnector = new GameObject("ROSConnector"); rosConnector.AddComponent <RosConnector>().RosBridgeServerUrl = address; rosConnector.AddComponent <JointStateSubscriber>(); Application.runInBackground = true; status["jointStatesMapped"].Set(); } else { Debug.LogWarning("Joint States Patching did not work! Robot not found..."); } }
//private UnityFibonacciActionClient UnityFibonacciActionClient; public void Awake() { UrdfRobot = GetComponents <UrdfRobot>()[0]; // gameObject.AddComponent<Status2Text>(); switch (TypeOfKSMP) { case KSMPs.ROS: //gameObject.AddComponent<RosConnector>(); //gameObject.AddComponent<PoseArrayPublisher>(); // If it does not exist if (GameObject.Find("RosConnector") == null) { RosConnectorObj = new GameObject("RosConnector"); } else { RosConnectorObj = GameObject.Find("RosConnector"); } if (!planRobot) { RosConnector = RosConnectorObj.AddComponent <RosConnector>(); gameObject.AddComponent <PoseArrayPublisher>(); } RosConnector = RosConnectorObj.GetComponent <RosConnector>(); RosConnector.RosBridgeServerUrl = NetworkMasterIP; switch (TypeOfEntity) { case EntityType.manipulator: gameObject.AddComponent <JointStatePatcher>(); JointPatcher = gameObject.GetComponent <JointStatePatcher>(); JointPatcher.UrdfRobot = UrdfRobot; JointPatcher.SetSubscribeJointStates(true); if (!planRobot) { JointStateSubscriber = gameObject.GetComponent <JointStateSubscriber>(); JointStateSubscriber.Topic = Topic; gameObject.AddComponent <ExecuteTrajFeedbackSub>(); gameObject.AddComponent <TrajectorySub>(); } else { gameObject.AddComponent <DisplayTrajectorySub>(); } /***************************** * Testing: uncomment JointState Subscri and delete DisplatT * ***************************/ //gameObject.AddComponent<DisplayTrajectorySub>(); break; case EntityType.AGV: // To be implemented break; case EntityType.drone: // To be implemented break; case EntityType.sensor: // To be implemented break; default: // To be implemented break; } break; case KSMPs.None: // To be implemented break; default: // To be implemented break; } }