
APT.all-test.Book-robot.clean-house.deposit-block.move-to-wall.elaborations.soar Maven / Gradle / Ivy
## If collision sensor is on, mark that there is a collision
sp {move-to-wall*elaborate*collision
(state ^name move-to-wall
^io.input-link.self.collision. true)
-->
( ^collision true)
}
## If collision distance (computed below) is < 30, mark that there is a collision
## This is used for walls
sp {move-to-wall*elaborate*collision-wall
(state ^name move-to-wall
^collision-distance < 30)
-->
( ^collision true)
}
## If there is an object that is within 30 and I'm headed for it, mark that there is a collision
sp {move-to-wall*elaborate*collision-object
(state ^name move-to-wall
^io.input-link.object )
( ^range < 30
^angle-off.yaw { < 0.2 > -0.2 })
-->
( ^collision true)
}
## If there none of the things above is true, mark that there is a not a collision
## Useful in other rules to compute both true and false for collision
sp {move-to-wall*elaborate*collision-false
(state ^name move-to-wall
-^io.input-link.object.range < 30
^collision-distance >= 30
^io.input-link.self.collision )
( ^x false
^y false)
-->
( ^collision false)
}
#### For each direction, compute the distance to the wall I'm headed toward
sp {move-to-wall*elaborate*collision-wall*north
(state ^name move-to-wall
^superstate.operator.wall-direction north
^io.input-link )
( ^self.position.y
^area-description.wall )
( ^direction north
^center.y )
-->
( ^collision-distance (- ))
}
sp {move-to-wall*elaborate*collision-wall*south
(state ^name move-to-wall
^superstate.operator.wall-direction south
^io.input-link )
( ^self.position.y
^area-description.wall )
( ^direction south
^center.y )
-->
( ^collision-distance (- ))
}
sp {move-to-wall*elaborate*collision-wall*west
(state ^name move-to-wall
^superstate.operator.wall-direction west
^io.input-link )
( ^self.position.x
^area-description.wall )
( ^direction west
^center.x )
-->
( ^collision-distance (- ))
}
sp {move-to-wall*elaborate*collision-wall*east
(state ^name move-to-wall
^superstate.operator.wall-direction east
^io.input-link )
( ^self.position.x
^area-description.wall )
( ^direction east
^center.x )
-->
( ^collision-distance (- ))
}
## The range to an object is its collision distance
## looks like a general case of collision-object above
sp {move-to-wall*elaborate*collision-object2
(state ^name move-to-wall
^io.input-link.object.range )
-->
( ^collision-distance )
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy