Operations research
robotic cell
A miniature production cell, on real hardware. A camera identifies the parts, a scheduler picks the order that finishes the batch soonest, and the arms coordinate over messages.
- 5
robotic arms
Controlled independently for four weeks, on a real cell.
- 800
batches ordered at the optimum
Out of 800 simulated batches, as many as by trying every possible order.
- 6
part types
Two shapes and three colors, which the camera tells apart on its own.
ChapterProblemContents
Problem
In what order to release the parts
A miniature production cell, with robotic arms linked by conveyors, a bin of parts at the start, processing stations. Not every part type visits the same stations. In what order should the parts be released so the whole batch finishes as early as possible?
It is a classic scheduling problem, the job-shop. Here it plays out on hardware that really moves, and that sometimes misses a pick. The final assessment: a demonstration on a batch laid out at random. The cycle ran to the end.

Constraints
A cell that discovers its batch
- The batch is seen, not declared. The source arm's camera photographs the bin; OpenCV recognizes each part from the shape of its contour and its color, then counts the batch.
- Every cycle is unique. The batch is laid at random in the bin and read by the camera. The route of each part type is drawn for every cycle: no station, one or both. Machining times are drawn at random, per type. The scheduler never solves the same problem twice.
- Everything is distributed. Each arm is an independent process with no shared memory. It must stay correct if a neighbor lags, restarts or misses a pick.
- The hardware misses picks. A grab can fail at the bin, on the belt or at the station, and the cycle has to carry on without anyone stepping in.

Architecture
The path of a part
The configuration delivered at the end of the project keeps three of the arms: a source arm and two processing stations, coordinated over MQTT. Follow one part.
A red square, drawn for both stations.
Processed at both stations, the batch completes.
IdentifyOpenCV
The source arm's camera photographs the bin; OpenCV recognizes each part from its contour and color, then counts the batch.
Example written for the illustration.
SchedulePython, NumPy
It works out the release order that finishes the batch soonest: every order on a small batch, the NEH heuristic beyond.
Example written for the illustration.
Timingsmetrics.py
Observed service and transit times are smoothed and reused for the next batch.
ReleaseNiryo Ned2, MQTT
The source arm places the parts on the conveyor one at a time, in the computed order, after asking the next station whether it is free.
Station 1pass-through sensor, MQTT
A pass-through sensor triggers the pick; the station accepts the part if it is free, otherwise it answers "busy" and the request is retried.
Example written for the illustration.
Grab worked?up to five attempts
Each grab gets up to five attempts; on failure, the station publishes a fault with the part's identifier, restarts the conveyor and releases the part.
Example written for the illustration.
Station 2Niryo Ned2, MQTT
The last station on the line: a part can reach it straight from the source arm, without going through station 1.
Batch doneCustomTkinter
An interface launches each arm, shows its state live and picks the scheduling method.
What holds the cell together
- Messages Quality of service 1 on every exchange; the broker keeps each arm's last state.
- Fail cleanly If a process dies, the broker announces the arm offline on its behalf. A global stop halts conveyors and arms.
- Recover Reconnection to an arm over six spaced attempts; at the station, a failed re-pick falls back to a recorded position.
- Supervise An interface launches each arm, shows its state live and picks the scheduling method.

From a single window, the operator starts and stops the arms, picks the scheduling method, launches a cycle and calibrates the cell. Each arm's state shows there live. A second interface tests the hardware one component at a time: vision, camera, pump, conveyor, positions.

Decisions
A protocol that stays correct when a pick fails
| Decision | Option ruled out | What settled it |
|---|---|---|
| Accept a part when the station is free | A reserved slot, timed to the second | On a missed pick, a reserved slot becomes invalid at once, and the whole downstream plan with it. Observed availability stays accurate. |
| Every order up to eight parts, NEH beyond | Exhaustive enumeration everywhere | Trying every order takes 0.18 s at eight parts, already 1.7 s at nine. |
| One program for every arm | One program per arm | Role, neighbors and positions come from the arm's identifier. Adding a station needs no new code. |
| A scheduler kept apart from arm control | Planning inside the arms' program | It knows nothing of arms or cameras: it can be rerun away from the cell, and that is what makes the results below measurable. |
| A load drawn at random for each batch | A fixed batch, always the same route | Without the draw, one batch looks like the last and the scheduler has nothing to decide. |
Results
What scheduling gains, in simulation
After the project, I reran the scheduling module as is, away from the cell, and compared it with the exact optimum.
Time lost without a good processing order. 0 is the best possible order, in simulation. +17%, no scheduling, median; +40%, worst order, median; +245%, no scheduling, worst batch. A station's time: 93 to 96% handling the part, the rest machining it.
All other measurements
- Gap between the best and the worst order, when only machining times change: 0.68% at the median, nearly sixty times smaller than when the parts' route changes. The lever is the parts' route, not the machining time.
- Batches where arrival order lands on the optimum: 25.06%.
- Batches where the hybrid strategy reaches the optimum: 0 draws out of 800.
- The model. The project's scheduling module, run as is, with the service and transit times smoothed by the cell.
- The reference. The exact optimum, found by trying the 720 possible orders of a full batch, one part of each type.
- The draws. The stations visited are drawn as in the real cycle: 800 batches to compare the strategies, 1,500 draws to measure the gap between orders.
- The status. Simulated, after the project, for this portfolio. None of these figures is a time measured on the line.
Limitations and lessons learned
Set up the control from the start
I built the exhaustive enumeration before comparing with “no scheduling”. That control, set up from the start, would have shown sooner that the hybrid strategy did worse than arrival order.
The cell timed the real duration of every batch without logging it. One line at the end of each cycle would have given a comparison between estimate and reality. Machining itself is a programmed wait, and the load draw seeds itself from the clock: no two cycles can be rerun identically.