Image Segmentation
PyTorch
English
painting-vision-robotics-kit
semantic-segmentation
robotics
edge-ai
construction-ai
autonomous-painting
wall-painting-robot
paint-coverage-estimation
building-facade
drywall
skirting-detection
window-detection
lidar
depth-validation
segformer
deeplabv3
Eval Results (legacy)
File size: 10,184 Bytes
4eecd03 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | #!/usr/bin/env python3
"""Application physics: how fast to move, how far apart to pass, and how much paint, for a film-thickness target.
The planner says *where* the tool goes; a coating spec says *how thick* the film must be. This module joins them.
Every relation is the standard one painters and coating inspectors use, with the assumptions written down:
* **Airless spray fan width** at the wall = 2 × standoff × tan(fan angle / 2). Tip codes follow the common
three-digit convention: first digit × 2 = fan width in inches at a 12 in standoff, last two digits = orifice in
thousandths of an inch (e.g. ``517`` = 10 in fan, 0.017 in orifice).
* **Tip flow** scales with the square root of pressure: Q = Q_rated × √(P / P_rated). ``TIP_FLOW_GPM`` holds
typical water-rated flows at 2000 psi; a manufacturer's chart for the actual tip and coating always wins.
* **Deposition.** With pass spacing ``s`` (fan width × (1 − overlap)) and traverse speed ``v``, the average wet film
is WFT = Q × TE / (v × s), where TE is transfer efficiency (paint that reaches the wall, not the air).
Dry film = WFT × volume solids. Solving for ``v`` gives the speed that hits a dry-film target.
* **Roller.** Rollers are specified by spread rate: area per volume at the target film; one load covers
``load_ml / (DFT / VS)`` of wall, which sets how often the robot must reload.
Units: SI internally (m, s, L, µm); inches/mils/gallons in and out where the trade uses them.
python3 application.py spray --tip 517 --pressure-psi 2000 --standoff-mm 300 --dft-um 40 --vs 0.38 --area-m2 42
"""
from __future__ import annotations
import argparse
import json
import math
from dataclasses import dataclass, asdict
GPM_TO_LPS = 3.785411784 / 60.0
INCH_MM = 25.4
MIL_UM = 25.4
# Typical water flow (US gal/min) at 2000 psi by orifice (thousandths of an inch). Order-of-magnitude values from
# common airless tip charts — use the manufacturer's chart for the tip actually fitted.
TIP_FLOW_GPM = {11: 0.12, 13: 0.18, 15: 0.24, 17: 0.31, 19: 0.38, 21: 0.47, 23: 0.57, 25: 0.67, 27: 0.78, 31: 1.03}
@dataclass(frozen=True)
class SprayTip:
code: str
fan_in_at_12: float
orifice_thou: int
@staticmethod
def parse(code: str) -> "SprayTip":
code = str(code).strip()
if len(code) != 3 or not code.isdigit():
raise ValueError(f"tip code {code!r}: expected three digits such as 517")
orifice = int(code[1:])
if orifice not in TIP_FLOW_GPM:
raise ValueError(f"tip {code}: no flow figure for a 0.0{orifice:02d} in orifice; pass --flow-lpm")
return SprayTip(code, int(code[0]) * 2.0, orifice)
@property
def fan_angle_deg(self) -> float:
return math.degrees(2 * math.atan((self.fan_in_at_12 / 2) / 12.0))
def flow_lps(self, pressure_psi: float, rated_psi: float = 2000.0) -> float:
return TIP_FLOW_GPM[self.orifice_thou] * GPM_TO_LPS * math.sqrt(pressure_psi / rated_psi)
def fan_width_mm(standoff_mm: float, fan_angle_deg: float) -> float:
return 2 * standoff_mm * math.tan(math.radians(fan_angle_deg) / 2)
def spray_settings(flow_lps, fan_angle_deg, standoff_mm, dft_um, volume_solids, overlap=0.5, transfer_efficiency=0.65,
coats=1, area_m2=None, max_speed_mm_s=1500.0, min_speed_mm_s=150.0, max_wet_um=200.0):
"""Pass spacing, traverse speed and paint for one coat (and the job, given an area). Raises on an impossible spec."""
if not 0 < volume_solids <= 1 or not 0 < transfer_efficiency <= 1 or not 0 <= overlap < 1:
raise ValueError("volume_solids and transfer_efficiency must be in (0, 1], overlap in [0, 1)")
width = fan_width_mm(standoff_mm, fan_angle_deg)
spacing = width * (1 - overlap)
wft_um = dft_um / volume_solids
# WFT (m) = Q (m³/s) × TE / (v (m/s) × s (m)) -> v = Q × TE / (WFT × s)
speed_m_s = flow_lps / 1000.0 * transfer_efficiency / (wft_um * 1e-6 * spacing / 1000.0)
speed = speed_m_s * 1000.0
notes = []
if speed > max_speed_mm_s:
notes.append(f"needs {speed:.0f} mm/s, above the {max_speed_mm_s:.0f} mm/s limit: use a smaller tip or lower pressure")
if wft_um > max_wet_um:
notes.append(f"{wft_um:.0f} µm wet in one coat is above ~{max_wet_um:.0f} µm, where wall paints sag: split into coats")
if speed < min_speed_mm_s:
notes.append(f"needs only {speed:.0f} mm/s: risk of runs; use a larger fan, a smaller orifice, or two thinner coats")
out = {"fan_width_mm": round(width, 1), "pass_spacing_mm": round(spacing, 1), "wet_film_um": round(wft_um, 1),
"wet_film_mils": round(wft_um / MIL_UM, 2), "dry_film_um": dft_um, "traverse_speed_mm_s": round(speed, 1),
"flow_l_min": round(flow_lps * 60, 3), "transfer_efficiency": transfer_efficiency,
"fan_angle_deg": round(fan_angle_deg, 2), "standoff_mm": standoff_mm, "notes": notes}
if area_m2:
paint_l = area_m2 * wft_um * 1e-6 * 1000.0 / transfer_efficiency * coats # litres pumped, incl. overspray
spray_s = paint_l / flow_lps
out.update({"area_m2": area_m2, "coats": coats, "paint_l": round(paint_l, 2), "paint_gal": round(paint_l / 3.785, 2),
"trigger_on_time_min": round(spray_s / 60, 1),
"pass_length_m": round(area_m2 * coats / (spacing / 1000.0), 1)})
return out
def roller_settings(nap_load_ml, dft_um, volume_solids, roller_width_mm=230.0, overlap=0.2, area_m2=None, coats=1):
"""How much wall one roller load covers at the target film, and the reload count for an area."""
wft_um = dft_um / volume_solids
per_load_m2 = nap_load_ml * 1e-6 / (wft_um * 1e-6)
out = {"wet_film_um": round(wft_um, 1), "area_per_load_m2": round(per_load_m2, 3),
"pass_spacing_mm": round(roller_width_mm * (1 - overlap), 1),
"stroke_length_per_load_m": round(per_load_m2 / (roller_width_mm * (1 - overlap) / 1000.0), 2)}
if area_m2:
out.update({"loads": math.ceil(area_m2 * coats / per_load_m2), "paint_l": round(area_m2 * coats * wft_um * 1e-3, 2)})
return out
def trigger_offsets(speed_mm_s, open_latency_s=0.05, close_latency_s=0.03):
"""How far before a stroke's start the gun must be told to open (and before its end to close) at this speed."""
return {"open_lead_mm": round(speed_mm_s * open_latency_s, 1), "close_lead_mm": round(speed_mm_s * close_latency_s, 1)}
def spray_reaction(flow_lps, pressure_psi, density_kg_m3=1100.0):
"""The push the jet puts back on the gun, and so on whatever is holding it.
Reaction is mass flow times exit speed: F = (Q rho) * sqrt(2 P / rho) = Q * sqrt(2 P rho). An airless tip at
2000 psi moving 1.17 L/min therefore pushes back with about 3.4 N (0.35 kgf). That is small next to a drone's
thrust, and it is not small next to the *quality* budget: it acts for a whole pass, on a long boom, and it moves the
nozzle off its standoff, which changes the fan width and so the film.
``density`` is the coating's (~1100 kg/m3 for wall paint); the pressure is the one at the tip, and a measured flow
always beats the tip table. The model ignores the fan's impingement on the wall (a wall jet pushes back a little
more) and any swirl: it is a lower bound, and it is stated as one.
"""
flow_lps, pressure_psi, density = float(flow_lps), float(pressure_psi), float(density_kg_m3)
if flow_lps < 0 or pressure_psi < 0 or density <= 0:
raise ValueError("flow, pressure and density must be non-negative (density positive)")
pressure_pa = pressure_psi * 6894.757
exit_ms = math.sqrt(2.0 * pressure_pa / density)
mass_flow = flow_lps / 1000.0 * density # L/s -> m3/s -> kg/s
force = mass_flow * exit_ms
return {"exit_ms": round(exit_ms, 1), "mass_flow_kg_s": round(mass_flow, 5),
"reaction_n": round(force, 2), "reaction_kg": round(force / 9.80665, 3),
"density_kg_m3": density, "pressure_psi": pressure_psi}
def main():
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
sub = ap.add_subparsers(dest="mode", required=True)
s = sub.add_parser("spray")
s.add_argument("--tip", help="three-digit tip code, e.g. 517")
s.add_argument("--flow-lpm", type=float, help="measured flow instead of the tip table")
s.add_argument("--fan-deg", type=float, help="fan angle, with --flow-lpm")
s.add_argument("--pressure-psi", type=float, default=2000)
s.add_argument("--standoff-mm", type=float, default=300)
s.add_argument("--dft-um", type=float, required=True, help="dry film per coat from the product data sheet")
s.add_argument("--vs", type=float, required=True, help="volume solids, 0-1, from the product data sheet")
s.add_argument("--overlap", type=float, default=0.5)
s.add_argument("--te", type=float, default=0.65, help="transfer efficiency")
s.add_argument("--area-m2", type=float)
s.add_argument("--coats", type=int, default=1)
r = sub.add_parser("roller")
r.add_argument("--load-ml", type=float, default=60)
r.add_argument("--dft-um", type=float, required=True)
r.add_argument("--vs", type=float, required=True)
r.add_argument("--width-mm", type=float, default=230)
r.add_argument("--area-m2", type=float)
r.add_argument("--coats", type=int, default=1)
a = ap.parse_args()
if a.mode == "spray":
if a.tip:
tip = SprayTip.parse(a.tip)
flow, angle = tip.flow_lps(a.pressure_psi), tip.fan_angle_deg
elif a.flow_lpm and a.fan_deg:
flow, angle = a.flow_lpm / 60.0, a.fan_deg
else:
ap.error("give --tip, or --flow-lpm with --fan-deg")
out = spray_settings(flow, angle, a.standoff_mm, a.dft_um, a.vs, a.overlap, a.te, a.coats, a.area_m2)
out["trigger"] = trigger_offsets(out["traverse_speed_mm_s"])
out["reaction"] = spray_reaction(flow, a.pressure_psi)
else:
out = roller_settings(a.load_ml, a.dft_um, a.vs, a.width_mm, area_m2=a.area_m2, coats=a.coats)
print(json.dumps(out, indent=2))
if __name__ == "__main__":
main()
|