public static List<string> GenerateSingleAction(string inPath, string outPath, string rosPackageName = "", bool verbose = false) { // If no ROS package name is provided, extract from path if (rosPackageName.Equals("")) { string[] hierarchy = inPath.Split(new char[] { '/', '\\' }); rosPackageName = hierarchy[hierarchy.Length - 3]; } outPath = Path.Combine(outPath, MsgAutoGenUtilities.ResolvePackageName(rosPackageName)); string inFileName = Path.GetFileNameWithoutExtension(inPath); if (verbose) { Console.WriteLine("Parsing: " + inPath); Console.WriteLine("Output Location: " + outPath); } MessageTokenizer tokenizer = new MessageTokenizer(inPath, new HashSet<string>(MsgAutoGenUtilities.builtInTypesMapping.Keys)); List<List<MessageToken>> listsOfTokens = tokenizer.Tokenize(); if (listsOfTokens.Count != 3) { throw new MessageParserException("Unexpected number of sections. Action should have 3 sections."); } List<string> warnings = new List<string>(); ActionWrapper actionWrapper = new ActionWrapper(inPath, rosPackageName, outPath); for (int i = 0; i < listsOfTokens.Count; i++) { List<MessageToken> tokens = listsOfTokens[i]; // Action is made up of goal, result, feedback string className = inFileName + types[i] + MsgAutoGenUtilities.ActionClassSuffix; // Parse and generate goal, result, feedback messages MessageParser parser = new MessageParser( tokens, outPath, rosPackageName, "action", MsgAutoGenUtilities.builtInTypesMapping, MsgAutoGenUtilities.builtInTypesDefaultInitialValues, className, subtopic: subtopics[i] ); parser.Parse(); warnings.AddRange(parser.GetWarnings()); // Generate action section wrapper messages actionWrapper.WrapActionSections(types[i]); } // Generate action wrapper actionWrapper.WrapAction(); return warnings; }