Ejemplo n.º 1
0
        public static string GetMessageClassPath(string inFilePath, string outPath)
        {
            string rosPackageName = MessageAutoGen.GetRosPackageName(inFilePath);
            string outFolder      = MessageAutoGen.GetMessageOutFolder(outPath, rosPackageName);
            string extension      = Path.GetExtension(inFilePath);
            string className      = MsgAutoGenUtilities.CapitalizeFirstLetter(Path.GetFileNameWithoutExtension(inFilePath));

            return(Path.Combine(outFolder, "msg", className + ".cs"));
        }
Ejemplo n.º 2
0
        public static string[] GetActionClassPaths(string inFilePath, string outPath)
        {
            string rosPackageName = MessageAutoGen.GetRosPackageName(inFilePath);
            string outFolder      = MessageAutoGen.GetMessageOutFolder(outPath, rosPackageName);
            string extension      = Path.GetExtension(inFilePath);
            string className      = MsgAutoGenUtilities.CapitalizeFirstLetter(Path.GetFileNameWithoutExtension(inFilePath)) + MsgAutoGenUtilities.ActionClassSuffix;

            string[] result = new string[types.Length];
            for (int Idx = 0; Idx < types.Length; ++Idx)
            {
                result[Idx] = Path.Combine(outFolder, "action", className + types[Idx] + ".cs");
            }
            return(result);
        }
Ejemplo n.º 3
0
        public MessageParser(List <MessageToken> tokens, string outPath, string rosPackageName, string type, Dictionary <string, string> builtInTypeMapping, Dictionary <string, string> builtInTypesDefaultInitialValues, string className = "", string rosMsgName = "", MessageSubtopic subtopic = MessageSubtopic.Default)
        {
            this.tokens = tokens;

            this.inFilePath = tokens[0].content;
            this.inFileName = Path.GetFileNameWithoutExtension(inFilePath);

            this.rosPackageName      = rosPackageName;
            this.rosPackageNamespace = MsgAutoGenUtilities.ResolvePackageName(rosPackageName);

            this.subtopic = subtopic;

            if (className.Equals(""))
            {
                this.className = MsgAutoGenUtilities.CapitalizeFirstLetter(inFileName) + MsgAutoGenUtilities.MessageClassSuffix;
            }
            else
            {
                this.className = className;
            }

            if (rosMsgName.Equals(""))
            {
                if (Char.IsLower(inFileName[0]))
                {
                    Debug.LogWarningFormat("File {0} starts with a lowercase character. Message file names should be PascalCased (see : http://wiki.ros.org/ROS/Patterns/Conventions#line-38)", inFileName);
                }
                this.rosMsgName = inFileName;
            }
            else
            {
                this.rosMsgName = rosMsgName;
            }


            this.outPath     = outPath;
            this.outFilePath = Path.Combine(outPath, type);

            this.tokens.RemoveAt(0);

            this.builtInTypeMapping = builtInTypeMapping;
            this.builtInTypesDefaultInitialValues = builtInTypesDefaultInitialValues;
        }