Skip to content

Lines of cells (bt.line)

A cell is authored where it is easiest to — at its own origin, its robot called arm, its start button desk/run — baked alone, and tested alone. A line is several such cells, some of them twice, and what runs between them. bt.line.assemble stands cells that were built on their own into one scene:

cast = casting_cell()                       # a bt.Scene, built, taught and programmed
cut = machining_cell()
line = bt.line.assemble([
    bt.line.Placed("cast", cast, (4.0, 15.0), yaw=math.pi),
    bt.line.Placed("cut_a", cut),
    bt.line.Placed("cut_b", cut, (10.0, 0.0)),            # the same cell, twice
], shared=("part/", "line/"))
tl = line.simulate_sequences(["cast/arm", "cut_a/tend", "cut_b/tend", ...])

Every name of a placed cell — its robots, obstacles, frames, signals, words, sensors, devices, programs, I/O nodes, scenarios, part programs — is found again under the cell's name (cut_a/arm, cut_a/desk/run, the word cut_a/count.out), and everything that stands in the world is moved to the cell's place and turned by its yaw. A cell stood in a line runs as it does alone: the same steps at the same times, until the line makes it wait.

What is the line's is said so. A name that begins with one of the shared prefixes is left as it is, and where several cells declare it it is one thing — the first cell's that declares it. That is how cells meet: the part one cell makes and the next one takes goes by one name in both (part/4124), and a word the line writes and a cell reads (line/wip.pallets: how many pallets the line has stood at the cell) is one word.

The scene that comes back is an ordinary scene. What belongs to no cell — the belts between them, the vehicles, the programs that answer the cells' calls — is authored on it as on any other, and reads and writes the cells' signals by their names in the line.

A cell is carried over as its project file is, so what a project keeps is what a line keeps. What this module does not know how to move — a taught Cartesian motion, a sensor mounted on a vehicle, an I/O map already assigned to addresses — is refused by name (bt.line.LineError) rather than stood wrong.

A long line's cycle goes to the studio at fewer samples a second than a cell's (thirty up to ten minutes of plant, fifteen up to twenty, ten beyond), a machine that stands still is sent with the two ends of its wait, and poses go to the micron: the picture is the same, and twelve minutes of a floor fit one message.

The worked line is examples/casting/diecast_factory_demo.py; the guide is Die casting.

line

A line: cells built on their own, stood on one floor.

A cell is authored where it is easiest to — at its own origin, its robot called arm, its belt in_belt, its start button desk/run. A line is several such cells, some of them twice, and what runs between them. This module stands cells into one scene:

cast = casting_cell()                       # a bt.Scene, built and programmed
cut = machining_cell()
line = bt.line.assemble([
    bt.line.Placed("cast", cast, (0.0, 0.0)),
    bt.line.Placed("cut_a", cut, (9.0, -8.0), yaw=math.pi / 2),
    bt.line.Placed("cut_b", cut, (15.0, -8.0), yaw=math.pi / 2),
])
line.simulate_sequences(["cast/arm", "cut_a/tend", "cut_b/tend", ...])

Every name of a placed cell — robots, obstacles, frames, signals, words, sensors, devices, programs, I/O nodes, scenarios, part programs — is found again under the cell's name (cut_a/arm, cut_a/desk/run, the word cut_a/count.out, the lane cut_a/in_belt.encoder), and everything that stands in the world is moved to the cell's place and turned by its yaw. What a cell says of itself stays true of it: its programs, its interlocks, its bill, its I/O list read the same, a prefix on.

shared names what is the line's and not a cell's: a name that begins with one of those prefixes is left as it is, and where several cells declare it (a part that one cell makes and the next one takes, a signal the line gives every cell) it is one thing — the first cell's that declares it, and what that cell says it is on the bill.

The scene that comes back is an ordinary scene: the line's own equipment — the vehicles between the cells, the programs that call them — is authored on it as on any other.

A cell is carried over as its project file is (Scene.save_project), so what a project keeps is what a line keeps. A cell with something this module does not know how to move — a taught Cartesian motion, a mounted sensor, an assigned I/O map — is refused by name rather than stood wrong.

LineError

Bases: builtins.ValueError

A cell that cannot be stood in a line as it is, and why.

Placed

A cell (scene, built on its own) under name, its origin at position (x, y) and turned by yaw about the vertical.

position class-attribute

position = (0.0, 0.0)

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

yaw class-attribute

yaw = 0.0

Convert a string or number to a floating-point number, if possible.

assemble

assemble(
    cells: Sequence[Placed],
    *,
    shared: Sequence[str] = (),
    path: Union[str, Path, None] = None,
)

Stands cells into one scene and returns it. shared are the name prefixes that belong to the line (see the module's text); path keeps the line's project file there (a .botrail), instead of in a temporary directory.

placed_name

placed_name(
    cell: str, name: Optional[str]
) -> Optional[str]

The name a cell's name goes by in a line.