Added robot DSL
authorNatanael Adityasatria <nata.adit@gmail.com>
Mon, 16 Nov 2015 20:31:12 +0000 (21:31 +0100)
committerNatanael Adityasatria <nata.adit@gmail.com>
Mon, 16 Nov 2015 20:31:12 +0000 (21:31 +0100)
natanael/dsl/robots.missions/TaskDSL.xtext [new file with mode: 0644]
natanael/dsl/robots.missions/description.txt [new file with mode: 0644]
natanael/dsl/robots.missions/spec1.tdsl [new file with mode: 0644]

diff --git a/natanael/dsl/robots.missions/TaskDSL.xtext b/natanael/dsl/robots.missions/TaskDSL.xtext
new file mode 100644 (file)
index 0000000..f735f97
--- /dev/null
@@ -0,0 +1,49 @@
+grammar robots.missions.TaskDSL with org.eclipse.xtext.common.Terminals
+
+generate taskDSL "http://www.missions.robots/TaskDSL"
+
+Robot:
+       'RobotName' name=ID
+       'LefMotor' leftMotor=LeftMotor
+       'RightMotor' righMotor=RightMotor
+       sensors+=Sensor+
+       behaviours+=Behaviour+;
+
+Behaviour:
+       'Behaviour' name=ID;
+
+Sensor:
+       'Sensor' name=ID
+       'SensorType' sensorType=SensorType;
+
+LeftMotor:
+       'Acceleration' acc=INT
+       'Speed' spd=INT;
+
+RightMotor:
+       'Acceleration' acc=INT
+       'Speed' spd=INT;
+
+SensorType:
+       TouchSensor | ColorSensor | UltrasonicSensor;
+
+TouchSensor:
+       'TouchSensor' leftPort=STRING rightPort=STRING;
+
+ColorSensor:
+       'ColorSensor' port=STRING
+       colors+=Color+;
+
+UltrasonicSensor:
+       'UltrasonicSensor' port=STRING
+       'limit' limit=STRING;
+
+Color:
+       'Color' name=ID
+       'ColorID' colorID=STRING;
+
+Model:
+       greetings+=Greeting*;
+
+Greeting:
+       'Hello' name=ID '!';
diff --git a/natanael/dsl/robots.missions/description.txt b/natanael/dsl/robots.missions/description.txt
new file mode 100644 (file)
index 0000000..71ad6a8
--- /dev/null
@@ -0,0 +1,14 @@
+• Short description of this proposal
+This grammar defines the robot mission using color, touch, and ultrasonic sensors.
+The grammar will require sensor port in every sensors used.
+
+• The three values used for defining this Xtext project:
+– Project name       : robots.missions
+– Language name      : robots.missions.TaskDSL
+– Extension          : tdsl
+
+• .xtext file with grammar
+- .xtext file attached
+
+• instance file(s)
+- .tdsl file attached
\ No newline at end of file
diff --git a/natanael/dsl/robots.missions/spec1.tdsl b/natanael/dsl/robots.missions/spec1.tdsl
new file mode 100644 (file)
index 0000000..8695107
--- /dev/null
@@ -0,0 +1,19 @@
+RobotName Rover1 
+
+LefMotor Acceleration 100 Speed 200
+RightMotor Acceleration 100 Speed 200
+
+Sensor touchSensor SensorType TouchSensor "S3" "S4"
+Sensor ultrasonicSensor SensorType UltrasonicSensor "S2" limit "0.512"
+Sensor colorSensor SensorType ColorSensor "S1" 
+       Color RED ColorID "RED"
+       Color BLUE ColorID "BLUE"
+       Color YELLOW ColorID "YELLOW"
+       Color WHITE ColorID "WHITE"
+       Color BLACK ColorID "BLACK"
+
+Behaviour Wander
+Behaviour StayInsideBlackLine
+Behaviour DetectColor
+Behaviour AvoidHighObject
+Behaviour AvoidLowObject
\ No newline at end of file