Skip to content

Component libraries ​

Every ref in a program names an entry of a component library: a part of the robot, an object the world places, or an environment a scenario takes. A library is a plain directory the compiler reads with --library; there is no install step and no default location.

sh
mobiledsl compile robot.core robot.world robot.task --library path/to/library --check

What is inside ​

text
<library>/
├── library.yaml                 the library's name and the ids of its parts
└── parts/<part-id>/
    ├── component.yaml           the part: shape, mass, mating points, what it can be used as
    └── assets/                  the mesh the part is drawn with

A part the library.yaml does not list does not exist to the compiler. Each part's component.yaml states:

  • its category: chassis, wheel, track, sensor, attachment, leg, motor, battery or motor_driver for a part of a robot, object or environment for a world;
  • its visual mesh, and a collision box that stands in for it;
  • its mass, centre of mass and inertia, with where the numbers came from;
  • its connectors, the named points where it mates with other parts;
  • its profiles, the component types it can be used as, such as Lidar or Diff_two_caster.

The library format specifies every field.

How a part is picked ​

Lidar top_lidar(ref = "lidar_ld06", ...) asks for the part lidar_ld06. The compiler checks that:

  • exactly one of the given libraries has a part with that id;
  • the part's category fits the component type, a sensor for Lidar;
  • the part lists the type under its profiles.

Each failure is its own diagnostic at the component.

Objects for the world ​

A library also holds objects, the things a world places: a crate, a table, a ramp. An object is an entry like a part, listed in library.yaml and declared in parts/<id>/component.yaml, with the category object. It states the mesh it is shown by and the shapes it collides by, and none of what a part states to be assembled and moved: no mass, no connectors, no profiles. An object is not bought, so it states no price either; its mesh may be a model that a collection publishes for simulators, and its entry then says where the model came from and under which licence.

Obstacle table(ref = "work_table", ...) in a .world file asks for the object work_table, and exactly one of the given libraries must have it. An id is a part's or an object's: a part named in a world, or an object named on a robot, is refused with what the entry is.

A library holds whole environments too, with the category environment: a room or a hall as its floor and a list of entities, each a primitive or one of the library's objects, written with the names a .world file uses. Scenario room(ref = "room_6x4") takes it, and its entities become the scenario's.

The world shows how an object is placed and an environment taken, and Adding your own part how each is declared.

Several libraries ​

Repeat --library to use several. A part must be in exactly one of them, so a library you keep next to your program can add parts to a shared catalog but not shadow one of its parts.

sh
mobiledsl compile robot.core robot.world robot.task \
  --library path/to/catalog --library my_parts --check

Incomplete parts ​

A shared catalog may hold a few parts that are not fully declared. Such a part is left out with a warning, and the rest of the library still serves every program that uses its complete parts. A program that names the part gets an error that says why it could not be loaded.

Meshes in the output ​

The compiler never opens a mesh; it copies each part's visual mesh, and each placed object's, into the output directory for the simulator to draw. The whole directory the mesh lies in is copied, since a mesh may keep its buffers, materials and textures in files beside it: put those there, and nothing else.

Next ​

Reading diagnostics shows how the compiler reports problems. To add a part of your own, see Adding your own part.