From 598b32f0a44d973a35eeab3894c27f93ee2e382e Mon Sep 17 00:00:00 2001 From: marvin <marvin@marvin-TERRA-MOBILE-1529H> Date: Thu, 19 Dec 2019 01:39:30 +0100 Subject: [PATCH] Refactored input/ output --- Varianten/AdapterFIDEROS/src/Adapter.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Varianten/AdapterFIDEROS/src/Adapter.java b/Varianten/AdapterFIDEROS/src/Adapter.java index a3fce3a..8cfed79 100644 --- a/Varianten/AdapterFIDEROS/src/Adapter.java +++ b/Varianten/AdapterFIDEROS/src/Adapter.java @@ -94,16 +94,17 @@ public class Adapter { */ public static void main(String[] args) { try { + //TODO + //######### Input ############################### Document featureModel = readXml("resources/input/featuremodel.xml"); Document sensorConfig = readXml("resources/input/sensorconfig.xml"); Document gazeboModel = null; - //TODO - //######### Operate on featuremodel.xml ######### //CustomBot not supported for now List<Attribute> botList = xQueryAttributes(featureModel, "//module[@types='TurtleBot']/@name"); - String botName = ""; + String fileName = ""; + switch(botList.size()) { case 0: System.out.println("Invalid input: No bot selected\n"); @@ -119,19 +120,19 @@ public class Adapter { } switch(botName) { case "Burger": - gazeboModel = readXml("resources/input/turtlebot3-master/turtlebot3_description/urdf/turtlebot3_burger.gazebo.xacro"); + fileName = "turtlebot3_burger.gazebo.xacro"; break; case "Waffle": - gazeboModel = readXml("resources/input/turtlebot3-master/turtlebot3_description/urdf/turtlebot3_waffle.gazebo.xacro"); + fileName = "turtlebot3_waffle.gazebo.xacro"; break; case "WafflePi": - gazeboModel = readXml("resources/input/turtlebot3-master/turtlebot3_description/urdf/turtlebot3_waffle_pi.gazebo.xacro"); + fileName = "turtlebot3_waffle_pi.gazebo.xacro"; break; default: System.out.println("Cannot handle \'"+botName+"\': No input file known.\n"); System.exit(-1); } - + gazeboModel = readXml("resources/input/turtlebot3-master/turtlebot3_description/urdf/"+fileName); //############################################### @@ -142,13 +143,12 @@ public class Adapter { //############################################### - FileOutputStream dest = new FileOutputStream("resources/output/turtlebot3_burger.gazebo.xacro"); - XMLOutputter xmlOutput = new XMLOutputter(); - //TODO //######### Output result ####################### + FileOutputStream dest = new FileOutputStream("resources/output/"+fileName); + XMLOutputter xmlOutput = new XMLOutputter(); + xmlOutput.output(gazeboModel, dest); - //############################################### -- GitLab