public override void OnInspectorGUI()
    {
        jointStateSubscriber = (JointStateSubscriber)target;
        DrawDefaultInspector();

        if (GUILayout.Button(jointStateSubscriberButtonLabel))
        {
            jointStateSubscriber.Start();
        }
        Application.runInBackground = true;
    }
Пример #2
0
        public void NewRobotSelected(GameObject robot)
        {
            //Debug.Log("new Robot Selected: " + robot.name);

            if (robot.GetComponent <RosConnector>() == null)
            {
                Debug.Log("Error: No rosConnector found");
                return;
            }

            robotManager         = robot;
            rosConnector         = robotManager.GetComponent <RosConnector>();
            jointStatePublisher  = robotManager.GetComponent <JointStatePublisher>();
            jointStateSubscriber = robotManager.GetComponent <JointStateSubscriber>();
            poseStampedPublisher = robotManager.GetComponent <CustomPoseStampedPublisher>();
            rosMode  = dropdownRobotManager.robotConfigs[dropdownRobotManager.robotDropdown.value].rosMode;
            poseMode = dropdownRobotManager.robotConfigs[dropdownRobotManager.robotDropdown.value].poseMode;
            rosModeDropdown.value   = rosMode;
            poseStampDropdown.value = poseMode;
            intervalSlider.value    = dropdownRobotManager.robotConfigs[dropdownRobotManager.robotDropdown.value].poseInterval;
        }
Пример #3
0
        public void NewRobotSelected(GameObject robot)
        {
            if (robot.GetComponent <RosConnector>() == null)
            {
                Debug.Log("Error: No rosConnector found");
                return;
            }

            robotManager         = robot;
            rosConnector         = robotManager.GetComponent <RosConnector>();
            jointStatePublisher  = robotManager.GetComponent <JointStatePublisher>();
            jointStateSubscriber = robotManager.GetComponent <JointStateSubscriber>();
            poseStampedPublisher = robotManager.GetComponent <CustomPoseStampedPublisher>();
            rosMode  = dropdownRobotManager.robotConfigs[dropdownRobotManager.currentRobot].rosMode;
            poseMode = dropdownRobotManager.robotConfigs[dropdownRobotManager.currentRobot].poseMode;
            rosModeDropdown.value   = rosMode;
            poseStampDropdown.value = poseMode;


            //intervalSlider.value = dropdownRobotManager.robotConfigs[dropdownRobotManager.currentRobot].poseInterval;   //Activate for non-MRTK applications
            intervalSlider.SliderValue = dropdownRobotManager.robotConfigs[dropdownRobotManager.currentRobot].poseInterval;
        }
        public override void OnInspectorGUI()
        {
            EditorGUILayout.HelpBox("This is the central point of your incoming robot communication. " +
                                    "Enter the details of your mqtt broker, the topic to subscribe to and specify the robotParent object. " +
                                    "Either presss play and see if your robotcontrollers are in the correct order, press on 'Find Joints and configure' or manually specificy the order.", MessageType.Info);

            DrawDefaultInspector();
            if (buttonStyle == null)
            {
                buttonStyle = new GUIStyle(EditorStyles.miniButtonRight)
                {
                    fixedWidth = 75
                }
            }
            ;

            jointStateSubscriber = (JointStateSubscriber)target;

            if (GUILayout.Button("Find joints in robot and configure"))
            {
                jointStateSubscriber.FindJoints();
            }
        }
    }
Пример #5
0
    //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;
        }
    }