Skip to content
Snippets Groups Projects
Commit 598b32f0 authored by marvin's avatar marvin
Browse files

Refactored input/ output

parent 38b3bea2
Branches
No related merge requests found
......@@ -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);
//###############################################
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment