From: Natanael Adityasatria Date: Mon, 16 Nov 2015 20:31:12 +0000 (+0100) Subject: Added robot DSL X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=d118d07941d26424e875dab5cdf711b185090d97;p=des2015.git Added robot DSL --- diff --git a/natanael/dsl/robots.missions/TaskDSL.xtext b/natanael/dsl/robots.missions/TaskDSL.xtext new file mode 100644 index 0000000..f735f97 --- /dev/null +++ b/natanael/dsl/robots.missions/TaskDSL.xtext @@ -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 index 0000000..71ad6a8 --- /dev/null +++ b/natanael/dsl/robots.missions/description.txt @@ -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 index 0000000..8695107 --- /dev/null +++ b/natanael/dsl/robots.missions/spec1.tdsl @@ -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