Skip to content
Browse files

adding line follower demo

  • Loading branch information...
1 parent 36b28e9 commit 1be06ec6b25505858491f7d4e100f56c04d9b70b Stephen Smith committed with cfinucane Aug 6, 2012
View
97 src/examples/lineFollower/configs/rock.config
@@ -0,0 +1,97 @@
+# This is a configuration definition file for the example "linefollower".
+# Format details are described at the beginning of each section below.
+
+
+======== General Config ========
+
+Actuator_Proposition_Mapping: # Mapping between actuator propositions and actuator handler functions
+turnOffLeft = NXT.NXTActuator.turnOffMotor(actuatorMotorPorts="PORT_C")
+dontMove = NXT.NXTActuator.turnOffMotor(actuatorMotorPorts="PORT_B.PORT_C")
+turnLeft = NXT.NXTActuator.turnOnMotor(actuatorMotorPorts="PORT_C",power=65) and NXT.NXTActuator.turnOnMotor(actuatorMotorPorts="PORT_B",power=-35)
+turnOffRight = NXT.NXTActuator.turnOffMotor(actuatorMotorPorts="PORT_B")
+turnRight = NXT.NXTActuator.turnOnMotor(actuatorMotorPorts="PORT_B",power=65) and NXT.NXTActuator.turnOnMotor(actuatorMotorPorts="PORT_C",power=-35)
+
+Initial_Truths: # Initially true propositions
+left
+
+Main_Robot: # The name of the robot used for moving in this config
+NXT
+
+Name: # Configuration name
+rock
+
+Sensor_Proposition_Mapping: # Mapping between sensor propositions and sensor handler functions
+black = NXT.NXTSensor.detectColor(colorPort="PORT_3",colorValue=2,operator="<")
+touch = NXT.NXTSensor.feel(touchPort="PORT_1")
+white = NXT.NXTSensor.detectColor(colorPort="PORT_3",colorValue=1,operator=">")
+
+
+======== Robot1 Config ========
+
+ActuatorHandler: # Actuator handler file in robots/Type folder
+basicSimActuator()
+
+CalibrationMatrix: # 3x3 matrix for converting coordinates, stored as lab->map
+array([[1, 0, 0],
+ [0, 1, 0],
+ [0, 0, 1]])
+
+DriveHandler: # Input value for robot drive handler, refer to file inside the handlers/drive folder
+holonomicDrive(multiplier=50.0,maxspeed=999.0)
+
+InitHandler: # Input value for robot init handler, refer to the init file inside the handlers/robots/Type folder
+basicSimInit(init_region="r1")
+
+LocomotionCommandHandler: # Input value for robot locomotion command handler, refer to file inside the handlers/robots/Type folder
+basicSimLocomotionCommand(speed=1.0)
+
+MotionControlHandler: # Input value for robot motion control handler, refer to file inside the handlers/motionControl folder
+vectorController()
+
+PoseHandler: # Input value for robot pose handler, refer to file inside the handlers/pose folder
+basicSimPose()
+
+RobotName: # Robot Name
+Basic Simulated Robot
+
+SensorHandler: # Sensor handler file in robots/Type folder
+basicSimSensor()
+
+Type: # Robot type
+basicSim
+
+
+======== Robot2 Config ========
+
+ActuatorHandler: # Actuator handler file in robots/Type folder
+NXTActuator()
+
+CalibrationMatrix: # 3x3 matrix for converting coordinates, stored as lab->map
+array([[ 1., 0., 0.],
+ [ 0., 1., 0.],
+ [ 0., 0., 1.]])
+
+DriveHandler: # Input value for robot drive handler, refer to file inside the handlers/drive folder
+NXTDrive()
+
+InitHandler: # Input value for robot init handler, refer to the init file inside the handlers/robots/Type folder
+NXTInit(brickMAC="00:16:53:14:1B:33")
+
+LocomotionCommandHandler: # Input value for robot locomotion command handler, refer to file inside the handlers/robots/Type folder
+NXTLocomotionCommand(leftDriveMotor="PORT_B",rightDriveMotor="PORT_C",steeringMotor="none",steeringGearRatio=1.0,leftForward=True,rightForward=True)
+
+MotionControlHandler: # Input value for robot motion control handler, refer to file inside the handlers/motionControl folder
+vectorController()
+
+PoseHandler: # Input value for robot pose handler, refer to file inside the handlers/pose folder
+NullPose(initial_region="r1")
+
+RobotName: # Robot Name
+NXT
+
+SensorHandler: # Sensor handler file in robots/Type folder
+NXTSensor()
+
+Type: # Robot type
+NXT
+
View
43 src/examples/lineFollower/linefollower.regions
@@ -0,0 +1,43 @@
+# This is a region definition file for the LTLMoP toolkit.
+# Format details are described at the beginning of each section below.
+# Note that all values are separated by *tabs*.
+
+Background: # Relative path of background image file
+None
+
+CalibrationPoints: # Vertices to use for map calibration: (vertex_region_name, vertex_index)
+
+Obstacles: # Names of regions to treat as obstacles
+
+Regions: # Stored as JSON string
+[
+ {
+ "name": "boundary",
+ "color": [176, 0, 255],
+ "holeList": [],
+ "points": [[0, 0], [276, 0], [574, 0], [574, 299], [276, 299], [0, 299]],
+ "position": [110, 75],
+ "type": "poly",
+ "size": [574, 299]
+ },
+ {
+ "name": "r2",
+ "color": [255, 255, 0],
+ "position": [386, 75],
+ "type": "rect",
+ "size": [298, 299]
+ },
+ {
+ "name": "r1",
+ "color": [204, 50, 50],
+ "position": [110, 75],
+ "type": "rect",
+ "size": [276, 299]
+ }
+]
+
+Transitions: # Region 1 Name, Region 2 Name, Bidirectional transition faces (face1_x1, face1_y1, face1_x2, face1_y2, face2_x1, ...)
+boundary r2 684 75 684 374 386 374 684 374 386 75 684 75
+boundary r1 110 374 386 374 110 75 386 75 110 75 110 374
+r2 r1 386 75 386 374
+
View
61 src/examples/lineFollower/linefollower.spec
@@ -0,0 +1,61 @@
+# This is a specification definition file for the LTLMoP toolkit.
+# Format details are described at the beginning of each section below.
+
+
+======== SETTINGS ========
+
+Actions: # List of action propositions and their state (enabled = 1, disabled = 0)
+turnLeft, 1
+turnRight, 1
+dontMove, 1
+
+CompileOptions:
+convexify: True
+fastslow: False
+
+CurrentConfigName:
+rock
+
+Customs: # List of custom propositions
+left
+right
+crossedBlackLeft
+crossedBlackRight
+stopEverything
+
+RegionFile: # Relative path of region description file
+linefollower.regions
+
+Sensors: # List of sensor propositions and their state (enabled = 1, disabled = 0)
+white, 1
+black, 1
+touch, 1
+
+
+======== SPECIFICATION ========
+
+RegionMapping: # Mapping between region names and their decomposed counterparts
+r1 = p2
+r2 = p1
+others =
+
+Spec: # Specification in structured English
+robot starts in r1 with left and not right and not crossedBlackLeft and not crossedBlackRight and not stopEverything
+#always (white and not black) or (black and not white)
+infinitely often touch
+
+always r1
+
+left is set on white and crossedBlackRight and reset on crossedBlackLeft and white
+right is set on white and crossedBlackLeft and reset on crossedBlackRight and white
+
+do turnLeft if and only if left and not right
+do turnRight if and only if right and not left
+
+crossedBlackLeft is set on black and left and reset on white and left
+crossedBlackRight is set on black and right and reset on white and right
+
+stopEverything is set on touch and not stopEverything and reset on touch and stopEverything
+
+if stopEverything then do dontMove
+

0 comments on commit 1be06ec

Please sign in to comment.
Something went wrong with that request. Please try again.