-
Notifications
You must be signed in to change notification settings - Fork 1
Tutorial: OAK Architecture
For several years, the Olin robotics lab has been trying to solve the long-standing problem of maintaining a large code-base created by many different students with varying levels of skill, different stylistic choices, and different organizational formats. The solution devised to this problem is the Olin Autonomy Kore, or OAK. OAK represents a structure for writing code that allows future users of a piece of code to know where parts are and how to change them. More information about the OAK architecture is available here (link). The architecture can be seen as having three levels (known as the Forebrain, Midbrain, and Hindbrain), each of which has three parts (known as Sensing, Thinking, and Acting).
One often helpful way to think about code for robots is in three levels: forebrain, midbrain, and hindbrain. Thinking about an actual robot, it's easiest to think of these levels from the bottom up.
- Hindbrain
- Low level control of the robot, includes interfaces with motors and simple sensors and manages most basic e-stop and other safety stops.
- If only the hindbrain is running, the robot should still be safe, and its failure modes should never result in an out-of control robot
- Midbrain
- Behavior level code, for example, go to waypoint, follow a line, or avoid obstacles
- This is essentially code for any single task a robot can do
- Often this code can be written to be somewhat platform independent because the various hindbrains should have as similar an interface as possible (for example, waypoint following code could work across all ground vehicles)
- Forebrain
- High level mission planning and decision making such as, given a list of tasks, decide on the best order, when to switch between tasks, and which pieces of the mission are most important
- An example would be deciding when to return to a base given the distance to the base and remaining battery life
In general, each brain level can run about an order of magnitude slower than the level below.
Within each of the "brains" there is some level of sensing, thinking, and acting. In the hindbrain, the sense and act portions are the largest, and it mostly passes information up to the midbrain and executes motor commands based on the midbrain's requests. Its think section typically just manages safety stops. The midbrain sense block reads from more complicated sensors and interprets more about the world based on the sensor readings from the hindbrain. The act section usually consists of multiple behaviors, each indicating what they would like the robot to do. The midbrain act takes all of the various requests and determines the best course of action for the robot. Forebrain sense generally converts information to global coordinates, think makes decisions based on everything the robot has seen so far (rather than midbrain, which usually relies on current or recent sensor values). Forebrain act can dictate which midbrain behaviors are active, and potentially their relative importance.