-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
問題のコード
| datatext = template.render({ "includeFiles":includeFiles, "pubMsgTypes":pubMsgTypes, "subMsgTypes":subMsgTypes }) |
該当の変数は、pubMsgTypesとsubMsgTypesで、生成コードが同じ型のものが複数出て来ると思います。
修正方法
重複するものを削ればOK
--- a/mros2_header_generator/templates_generator.py
+++ b/mros2_header_generator/templates_generator.py
@@ -55,9 +55,11 @@ def main():
includeFile = '#include "' + includeFile + '.hpp"'
includeFiles.append(includeFile)
+ unique_pubMsgTypes = list(set(pubMsgTypes))
+ unique_subMsgTypes = list(set(subMsgTypes))
env = Environment(loader=FileSystemLoader(path.dirname(__file__)))
template = env.get_template('templates.tpl')
- datatext = template.render({ "includeFiles":includeFiles, "pubMsgTypes":pubMsgTypes, "subMsgTypes":subMsgTypes })
+ datatext = template.render({ "includeFiles":includeFiles, "pubMsgTypes":unique_pubMsgTypes, "subMsgTypes":unique_subMsgTypes })
outfile_path = os.path.join(outdir, "templates.hpp")
outtemp_path = os.path.join(outdir, "templates.hpp.tmp")
Metadata
Metadata
Assignees
Labels
No labels