Esempio n. 1
0
    //=================================================================================
    //Generate ROS Messages
    //=================================================================================
    private static bool CreateScript()
    {
        ActionMessageGenerator.Generate("MoveBase", "move_base_msgs",
                                        new MessageElement[] { new MessageElement("PoseStamped", "target_pose", false) },
                                        new MessageElement[] { },
                                        new MessageElement[] { new MessageElement("PoseStamped", "base_position", false) },
                                        OUT_PATH);
        Debug.Log("Create Message Done");

        return(true);
    }
Esempio n. 2
0
        private void OnGUI()
        {
            GUILayout.Label("Message Generator (Action Message)", EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal();
            actionName = EditorGUILayout.TextField("Action Name", actionName);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            rosPackageName = EditorGUILayout.TextField("ROS Package Name", rosPackageName);
            EditorGUILayout.EndHorizontal();


            EditorGUILayout.BeginHorizontal();
            ScriptableObject target_goal = this;

            serializedObject_goal = new SerializedObject(target_goal);
            serializedObject_goal.Update();
            serializedProperty_goal = serializedObject_goal.FindProperty("goalElements");
            EditorGUILayout.PropertyField(serializedProperty_goal, true);
            serializedObject_goal.ApplyModifiedProperties();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            ScriptableObject target = this;

            serializedObject_result = new SerializedObject(target);
            serializedObject_result.Update();
            serializedProperty_result = serializedObject_result.FindProperty("resultElements");
            EditorGUILayout.PropertyField(serializedProperty_result, true);
            serializedObject_result.ApplyModifiedProperties();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            ScriptableObject target_feedback = this;

            serializedObject_feedback = new SerializedObject(target);
            serializedObject_feedback.Update();
            serializedProperty_feedback = serializedObject_feedback.FindProperty("feedbackElements");
            EditorGUILayout.PropertyField(serializedProperty_feedback, true);
            serializedObject_feedback.ApplyModifiedProperties();
            EditorGUILayout.EndHorizontal();


            GUILayout.Space(40);
            EditorGUILayout.BeginHorizontal();
            assetPath = EditorGUILayout.TextField("Asset Path", assetPath);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            if (GUILayout.Button("Set Default Path", GUILayout.Width(150)))
            {
                DeleteEditorPrefs();
                GetEditorPrefs();
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(20);
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Generate Action Messages"))
            {
                SetEditorPrefs();
                ActionMessageGenerator.Generate(actionName, rosPackageName,
                                                goalElements, resultElements, feedbackElements, assetPath);
                AssetDatabase.Refresh();
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(20);

            EditorGUIUtility.labelWidth = 300;
        }