From b2543c3672ecdf20aecd8e6f313d8bb6503d8bd8 Mon Sep 17 00:00:00 2001 From: Igor Brylyov Date: Thu, 10 Mar 2022 17:00:29 +0300 Subject: [PATCH] Export Grasp Poses only for parts with Grasp Poses --- ARTools.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ARTools.py b/ARTools.py index b6cf099..65d2a84 100644 --- a/ARTools.py +++ b/ARTools.py @@ -256,10 +256,11 @@ def exportGazeboModels(): config_file.write(GazeboExport.config(obj.Label, 'model.sdf', 'Author', 'Email', 'Comment', 'Version')) - with open(os.path.join(model_dir, 'frames.json'), 'w') as frames_file: - # frames_file.write(json.dumps(parts[obj.Label]["graspposes"])) - json.dump({"features": { "grasp-poses" : parts[obj.Label]["graspposes"]}}, - frames_file, indent=1, separators=(',', ': ')) + if len(parts[obj.Label]["graspposes"]) > 0: + with open(os.path.join(model_dir, 'frames.json'), 'w') as frames_file: + # frames_file.write(json.dumps(parts[obj.Label]["graspposes"])) + json.dump({"features": { "grasp-poses" : parts[obj.Label]["graspposes"]}}, + frames_file, indent=1, separators=(',', ': ')) return True