Robot Code Layout

From Robowiki
Revision as of 17:48, 13 September 2011 by Voidious (talk | contribs) (moved Layout to Robot Code Layout: "Layout" is vague, and even "Code Layout" would be slightly ambiguous)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Visualization of different robot layouts.

The layout of a robot is basically its design structure.

There are 3 basic types of structures used by robots.

Combined Layout

This structure is mostly used by codesize restricted or simple robots. Such as most Nano, Micro and Mini robots.

Pros

In this layout each part of the robot parts, such as the radar, gun and movement are all contained within the main robot file itself, this allows a very close tie between the parts of the robot allowing them to easily interact with each other.

Cons

This type of layout quickly gets unmanageable as to the number of methods and fields in the simple class grow, making locating and debugging code much more difficult.

Modular Layout

May also be called a Spider Layout. This layout is used in most megabots and otherwise large or well structured robots. It is used for its simplicity of design and ability to easily test many different options while designing a robot.

In these each of the parts of the robot, such as radar, gun and movement are separated out into easily interchanged classes, which are then encapsulated within the main robot in some fashion.

Pros

These modules are usually still tied closely to the robot they were designed for. However despite this, their self contained design makes them far easier to move to another robot then a non-modular design.

Cons

Attempting to have modules that rely on each other is a large source of code bloat for these robots, in which it cannot usually be done in a simple manner.

Tower Layout

This layout is rather unused, mostly due to some minor design complexities. This design does not have the benefits of the modular layout, and is more of an expanded Combined layout, with the robot's parts separated into different modules which are stacked on top of each other. One part of the robot extending the previous.

Pros

This layout is somewhat of a middle ground between a modular and a combined layout. Like a combined layout the modules can easily rely on each other, and like a modular layout the code is separated into easy to work on modules.

Cons

However this type of layout lacks modularity. So the ability to quickly and easily switch between different modules of the same type is lost. It also make it more difficult for other robots to adapt the modules into their code. There is also the issue of order of modules and calling and overriding methods, which make this layout somewhat more complicated to use.

This article is a stub. You can help RoboWiki by expanding it.