;;Entities that need to be defined: ;;widthLimit - a BinaryPredicate between a CarryBot and a Length Measure that is how wide CarryBot's carrying tray is. ;;lengthLimit - a BinaryPredicate between a CarryBot and a Length Measure that is how long the CarryBot's carrying tray is (length is ;;distance away from front of bot). ;;massLimit - a BinaryPredicate between a CarryBot and a Mass Measure that is how much weight the CarryBot can carry. (subclass CarryBot Agent) ;;Define a BinaryPredicate, canCarry. (documentation canCarry EnglishLanguage "A robot can &%carry the object.") (domain canCarry 1 CarryBot) (domain canCarry 2 Object) (instance canCarry BinaryPredicate) (=> (canCarry ?ROBOT ?OBJECT) (modalAttribute (exists (?CARRY) (and (instance ?CARRY Carrying) (instrument ?CARRY ?ROBOT) (patient ?CARRY ?OBJECT))) Possibility)) ;;If all 3 dimensions of an object, or diameter of a sphere, are greater than the widthLimit, then the robot cannot carry the object. (instance widthLimit BinaryPredicate) (domain widthLimit 1 CarryBot) (domain widthLimit 2 LengthMeasure) (=> (and (instance ?ROBOT CarryBot) (instance ?INSTANCE ?OBJECT) (subclass ?OBJECT Object) (widthLimit ?ROBOT (MeasureFn ?WIDTHLIMIT ?UNIT)) (or (and (defaultMaximumLength ?OBJECT (MeasureFn ?LENGTH ?UNIT)) (defaultMaximumWidth ?OBJECT (MeasureFn ?WIDTH ?UNIT)) (defaultMaximumHeight ?OBJECT (MeasureFn ?HEIGHT ?UNIT)) (greaterThan ?LENGTH ?WIDTHLIMIT) (greaterThan ?WIDTH ?WIDTHLIMIT) (greaterThan ?HEIGHT ?WIDTHLIMIT)) (and (defaultMaximumSphereRadius ?OBJECT (MeasureFn ?RADIUS ?UNIT)) (greaterThan (MultiplicationFn ?RADIUS 2) ?WIDTHLIMIT)))) (not (canCarry ?ROBOT ?INSTANCE))) ;;If at least 2 dimensions of an object are greater than the lengthLimit, then the robot cannot carry the object. Or, if the object is a sphere, ;;the diameter can't be larger than half of the length limit. ;;UNIT DIFFERENCES (instance lengthLimit BinaryPredicate) (domain lengthLimit 1 CarryBot) (domain lengthLimit 2 LengthMeasure) (=> (and (lengthLimit ?ROBOT (MeasureFn ?LENGTHLIMIT ?UNIT)) (instance ?INSTANCE ?OBJECT) (subclass ?OBJECT Object) (or (and (defaultMaximumLength ?OBJECT (MeasureFn ?LENGTH ?UNIT)) (defaultMaximumWidth ?OBJECT (MeasureFn ?WIDTH ?UNIT)) (defaultMaximumHeight ?OBJECT (MeasureFn ?HEIGHT ?UNIT))) (or (and (greaterThan ?LENGTH ?LENGTHLIMIT) (greaterThan ?WIDTH ?LENGTHLIMIT)) (and (greaterThan ?LENGTH ?LENGTHLIMIT) (greaterThan ?HEIGHT ?LENGTHLIMIT)) (and (greaterThan ?WIDTH ?LENGTHLIMIT) (greaterThan ?HEIGHT ?LENGTHLIMIT))) (and (defaultMaximumSphereRadius ?OBJECT (MeasureFn ?RADIUS ?UNIT)) (greaterThan (MultiplicationFn ?RADIUS 2) (DivisionFn ?LENGTHLIMIT 2))))) (not (canCarry ?ROBOT ?INSTANCE))) ;;If an object is heavier than the massLimit, the robot cannot carry the object. ;;UNIT DIFFERENCES (instance massLimit BinaryPredicate) (domain massLimit 1 CarryBot) (domain massLimit 2 Quantity) (=> (and (massLimit ?ROBOT (MeasureFn ?MASSLIMIT ?UNITOFMASS)) (instance ?INSTANCE ?OBJECT) (subclass ?OBJECT Object) (instance ?UNITOFMASS UnitOfMass) (defaultMaximumMeasure ?OBJECT (MeasureFn ?NUM ?UNITOFMASS)) (greaterThan ?NUM ?MASSLIMIT)) (not (canCarry ?ROBOT ?INSTANCE))) ;;If there exists a doorway that lies in the robot's path and is less wide or less tall than the robot/object combination, ;;then the robot cannot carry the object. This means the robot must have attributes width and height. ;;(=> ;; (and ;; (instance ?DOOR Door) ;; (instance ?ROBOT CarryBot) ;; (instance ?MOVE Translocation) ;; (instance ?INSTANCE ?OBJECT) ;; (instrument ?MOVE ?ROBOT) ;; (patient ?MOVE ?INSTANCE) ;; (destination ?MOVE ?GOAL) ;; (between ?ROBOT ?DOOR ?GOAL) ;; (width ?DOOR ?DOORWIDTH) ;; (width ?ROBOT ?BOTWIDTH) ;; (height ?DOOR ?DOORHEIGHT) ;; (height ?ROBOT ?BOTHEIGHT) ;; (or ;; (defaultMaximumHeight ?INSTANCE ?HEIGHT) ;; (defaultMaximumWidth ?INTSTANCE ?WIDTH) ;; (defaultMaximumRadius ?INSTANCE ?RADIUS)) ;; (or ;; (lessThan ?DOORHEIGHT (AdditionFn ?HEIGHT ?BOTHEIGHT)) ;; (lessThan ?DOORWIDTH (AdditionFn ?WIDTH ?BOTHEIGHT)) ;; (lessThan ?DOORHEIGHT (AdditionFn ?HEIGHT (MultiplicationFn ?RADIUS 2))))) ;; (not ;; (canCarry ?ROBOT ?INSTANCE)))