Blueprints
Blueprints (BlueprintAtom) are instructions for how to initialize a Module.
You don’t typically want to run a single module, so multiple blueprints are handled together in Blueprint.
You create a Blueprint from a single module (say ConnectionModule) with:
session=blueprint-ex1
session=blueprint-ex1
skip session=blueprint-ex1
Linking blueprints
You can link multiple blueprints together withautoconnect:
session=blueprint-ex1
blueprint itself is a Blueprint so you can link it with other modules:
session=blueprint-ex1
autoconnect() always constructs an expanded blueprint so you never have to worry about changes in one affecting the other.
Duplicate module handling
If the same module appears multiple times inautoconnect, the later blueprint wins and overrides earlier ones:
session=blueprint-ex1
How transports are linked
Imagine you have this code:session=blueprint-ex1
(property_name, object_type). In this case ('image', Image) will be connected between the two modules, but begin_explore will not be linked to start_explore.
Topic names
By default, the name of the property is used to generate the topic name. So forimage, the topic will be /image.
The property name is used only if it’s unique. If two modules have the same property name with different types, then both get a random topic such as /SGVsbG8sIFdvcmxkI.
If you don’t like the name you can always override it like in the next section.
Which transport is used?
By defaultLCMTransport is used if the object supports lcm_encode. If it doesn’t pLCMTransport is used (meaning “pickled LCM”).
You can override transports with the transports method. It returns a new blueprint in which the override is set.
session=blueprint-ex1
expanded_blueprint does not get the transport overrides because it’s created from the initial value of base_blueprint, not the second.
Remapping connections
Sometimes you need to rename a connection to match what other modules expect. You can useremappings to rename module connections:
session=blueprint-ex2
- The
color_imageoutput fromConnectionModuleis treated asrgb_image - It automatically connects to any module with an
rgb_imageinput of typeImage - The topic name becomes
/rgb_imageinstead of/color_image
session=blueprint-ex2
Overriding global configuration.
Each module includes the global config available asself.config.g. E.g.:
session=blueprint-ex3
session=blueprint-ex3
Providing blueprint configuration to users
Blueprint.config() can be used to get a pydantic.BaseModel that can be used to
inspect or test configuration settings that can be passed to Blueprint.build():
session=blueprint-ex1
dimos.robot.cli.dimos.arg_help() is a helper function that will return a string
containing all details of these arguments (this is how the output is produced when
running dimos run unitree-go2 --help, for example):
session=blueprint-ex1
dimos.robot.cli.dimos.load_config_args() which can create the
argument dict for users from a config file, environment variables and CLI arguments:
session=blueprint-ex1
Calling the methods of other modules
Imagine you have this code:session=blueprint-ex3
ModuleA.get_time in ModuleB.request_the_time.
To do this, you can request a module reference.
session=blueprint-ex3
HelperModule to work for more than just Drone? For that we can use a spec.
session=blueprint-ex3
Optional module references
If a dependency might not be present in every blueprint, annotate it asSomeSpec | None = None. The blueprint will try to resolve it but won’t raise if no matching module is found:
session=blueprint-ex3
Defining skills
Skills are methods on aModule decorated with @skill. The agent automatically discovers all skills from launched modules at startup.
session=blueprint-ex4
Building
All you have to do to build a blueprint is call:skip session=blueprint-ex4
ModuleCoordinator instance that manages all deployed modules.
Running and shutting down
You can block the thread until it exits with:skip session=blueprint-ex4
