Skip to content
Snippets Groups Projects
Commit 9287757d authored by René Schöne's avatar René Schöne
Browse files

Update preprocessor and mustache.

parent 7496e1b5
No related branches found
No related tags found
No related merge requests found
Subproject commit 130a96efa74f90c9d2f8634e2ddc6d6c705f146d Subproject commit c10bed0d03e3fa18b8133ce1de48de7646899615
package org.jastadd.ragconnect.compiler; package org.jastadd.ragconnect.compiler;
import org.jastadd.ragconnect.ast.*; import org.jastadd.ragconnect.ast.Document;
import org.jastadd.ragconnect.parser.RagConnectParser; import org.jastadd.ragconnect.ast.ListElement;
import org.jastadd.ragconnect.scanner.RagConnectScanner; import org.jastadd.ragconnect.ast.MappingElement;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.Paths;
/** /**
* Testing Ros2Rag without parser. * Testing Ros2Rag without parser.
...@@ -19,70 +15,64 @@ public class SimpleMain { ...@@ -19,70 +15,64 @@ public class SimpleMain {
Document doc = new Document(); Document doc = new Document();
MappingElement root = new MappingElement(); MappingElement root = new MappingElement();
MappingElement firstLevel = new MappingElement(); MappingElement firstLevel = new MappingElement();
firstLevel.addKeyValuePair(new KeyValuePair("server", new StringElement("tcp://localhost:1883"))); firstLevel.put("server", "tcp://localhost:1883");
firstLevel.addKeyValuePair(new KeyValuePair("robot_speed_factor", new ValueElement(".7"))); firstLevel.put("robot_speed_factor", ".7");
KeyValuePair topics = new KeyValuePair();
topics.setKey("topics");
MappingElement theTopics = new MappingElement(); MappingElement theTopics = new MappingElement();
theTopics.addKeyValuePair(new KeyValuePair("robotConfig", new StringElement("robotconfig"))); theTopics.put("robotConfig", "robotconfig");
theTopics.addKeyValuePair(new KeyValuePair("trajectory", new StringElement("trajectory"))); theTopics.put("trajectory", "trajectory");
theTopics.addKeyValuePair(new KeyValuePair("nextStep", new StringElement("ros2rag/nextStep"))); theTopics.put("nextStep", "ros2rag/nextStep");
topics.setValue(theTopics); firstLevel.put("topics", theTopics);
firstLevel.addKeyValuePair(topics);
firstLevel.addKeyValuePair(new KeyValuePair("zone_size", new ValueElement("0.5"))); firstLevel.put("zone_size", "0.5");
ListElement theZones = new ListElement(); ListElement theZones = new ListElement();
theZones.addElement(new StringElement("1 1")); theZones.add("1 1");
theZones.addElement(new StringElement("0 1")); theZones.add("0 1");
theZones.addElement(new StringElement("-1 1")); theZones.add("-1 1");
firstLevel.addKeyValuePair("zones", theZones); firstLevel.put("zones", theZones);
MappingElement pandaParts = new MappingElement(); MappingElement pandaParts = new MappingElement();
MappingElement thePanda = new MappingElement(); MappingElement thePanda = new MappingElement();
thePanda.addKeyValuePair(new KeyValuePair("Link0", new StringElement("panda_link0"))); thePanda.put("Link0", "panda_link0");
thePanda.addKeyValuePair(new KeyValuePair("Link1", new StringElement("panda_link1"))); thePanda.put("Link1", "panda_link1");
thePanda.addKeyValuePair(new KeyValuePair("Link2", new StringElement("panda_link2"))); thePanda.put("Link2", "panda_link2");
thePanda.addKeyValuePair(new KeyValuePair("Link3", new StringElement("panda_link3"))); thePanda.put("Link3", "panda_link3");
thePanda.addKeyValuePair(new KeyValuePair("Link4", new StringElement("panda_link4"))); thePanda.put("Link4", "panda_link4");
thePanda.addKeyValuePair(new KeyValuePair("Link5", new StringElement("panda_link5"))); thePanda.put("Link5", "panda_link5");
thePanda.addKeyValuePair(new KeyValuePair("Link6", new StringElement("panda_link6"))); thePanda.put("Link6", "panda_link6");
thePanda.addKeyValuePair(new KeyValuePair("RightFinger", new StringElement("panda_rightfinger"))); thePanda.put("RightFinger", "panda_rightfinger");
thePanda.addKeyValuePair(new KeyValuePair("LeftFinger", new StringElement("panda_leftfinger"))); thePanda.put("LeftFinger", "panda_leftfinger");
pandaParts.addKeyValuePair("panda", thePanda); pandaParts.put("panda", thePanda);
firstLevel.addKeyValuePair("parts", pandaParts); firstLevel.put("parts", pandaParts);
MappingElement endEffectorParts = new MappingElement(); MappingElement endEffectorParts = new MappingElement();
MappingElement endEffector = new MappingElement(); MappingElement endEffector = new MappingElement();
endEffector.addKeyValuePair("EndEffector", new StringElement("panda_hand")); endEffector.put("EndEffector", "panda_hand");
endEffectorParts.addKeyValuePair("panda", endEffector); endEffectorParts.put("panda", endEffector);
firstLevel.addKeyValuePair("end_effectors", endEffectorParts); firstLevel.put("end_effectors", endEffectorParts);
KeyValuePair goalPoses = new KeyValuePair();
goalPoses.setKey("goal_poses");
ListElement theGoalPoses = new ListElement(); ListElement theGoalPoses = new ListElement();
addPose(theGoalPoses, "0.4 0.4 0.3"); theGoalPoses.add(makePose("0.4 0.4 0.3"));
addPose(theGoalPoses, "-0.4 0.4 0.3"); theGoalPoses.add(makePose("-0.4 0.4 0.3"));
addPose(theGoalPoses, "-0.4 -0.4 0.3"); theGoalPoses.add(makePose("-0.4 -0.4 0.3"));
addPose(theGoalPoses, "0.4 0.4 0.3"); theGoalPoses.add(makePose("0.4 0.4 0.3"));
addPose(theGoalPoses, "-0.4 0.4 0.3"); theGoalPoses.add(makePose("-0.4 0.4 0.3"));
addPose(theGoalPoses, "0.4 0.4 0.3"); theGoalPoses.add(makePose("0.4 0.4 0.3"));
goalPoses.setValue(theGoalPoses); firstLevel.put("goal_poses", theGoalPoses);
firstLevel.addKeyValuePair(goalPoses);
root.addKeyValuePair("panda_mqtt_connector", firstLevel); root.put("panda_mqtt_connector", firstLevel);
doc.setRootElement(root); doc.setRootElement(root);
System.out.println(doc.prettyPrint()); System.out.println(doc.prettyPrint());
} }
private static void addPose(ListElement theGoalPoses, String position) { private static MappingElement makePose(String position) {
MappingElement goalPose1 = new MappingElement(); MappingElement goalPose = new MappingElement();
goalPose1.addKeyValuePair(new KeyValuePair("position", new StringElement(position))); goalPose.put("position", position);
goalPose1.addKeyValuePair(new KeyValuePair("orientation", new StringElement("1 1 0 0"))); goalPose.put("orientation", "1 1 0 0");
goalPose1.addKeyValuePair(new KeyValuePair("work", new StringElement("20000"))); goalPose.put("work", "20000");
theGoalPoses.addElement(goalPose1); return goalPose;
} }
public static void main(String[] args) { public static void main(String[] args) {
......
Subproject commit 79d237fda220364ffebf77dc7de0a7b29635e360 Subproject commit c00441c03dc6723a08de0fcb041254a99497774f
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment