feat(capture): detect the flat pose for targets laid on the ground

This commit is contained in:
qlionbleusam
2026-08-29 10:33:59 +02:00
parent 869835f234
commit 8804d8b6a1
3 changed files with 262 additions and 22 deletions
+25 -9
View File
@@ -169,8 +169,9 @@ class _CaptureScreenState extends State<CaptureScreen>
final prev = _parallelismData;
final bool changed = prev == null ||
prev.status != data.status ||
prev.pitchDegrees.toStringAsFixed(1) !=
data.pitchDegrees.toStringAsFixed(1) ||
prev.pose != data.pose ||
prev.pitchDeviation.toStringAsFixed(1) !=
data.pitchDeviation.toStringAsFixed(1) ||
prev.rollDegrees.toStringAsFixed(1) !=
data.rollDegrees.toStringAsFixed(1);
@@ -218,16 +219,21 @@ class _CaptureScreenState extends State<CaptureScreen>
return 'ALIGNEZ LA CIBLE DANS LE CADRE';
}
final bool onGround = _parallelismData!.pose == TargetPose.ground;
// Aligné → message de validation (avec bonus si la cible est détectée)
if (_parallelismData!.isAligned) {
return _targetReady
? 'PARFAIT — CIBLE DÉTECTÉE, PRÊT'
if (_targetReady) return 'PARFAIT — CIBLE DÉTECTÉE, PRÊT';
return onGround
? 'CIBLE AU SOL — PRÊT À PHOTOGRAPHIER'
: 'PARALLÈLE OK — PRÊT À PHOTOGRAPHIER';
}
// Mal aligné → message directif selon l'axe le plus dévié
final double pitch = _parallelismData!.pitchDegrees;
final double roll = _parallelismData!.rollDegrees;
// Mal aligné → message directif selon l'axe le plus dévié.
// On raisonne sur les écarts à la pose détectée, pas sur le tangage brut :
// à plat, celui-ci vaut -90° alors que le cadrage peut être parfait.
final double pitch = _parallelismData!.pitchDeviation;
final double roll = _parallelismData!.rollDeviation;
if (pitch.abs() >= roll.abs()) {
return pitch > 0
@@ -776,15 +782,25 @@ class _CaptureScreenState extends State<CaptureScreen>
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
data.pose == TargetPose.ground ? 'CIBLE AU SOL' : 'CIBLE AU MUR',
style: TextStyle(
color: color,
fontSize: 10,
fontWeight: FontWeight.w700,
letterSpacing: 0.5,
),
),
const SizedBox(height: 4),
_buildAngleRow(
label: 'Pitch',
value: data.pitchDegrees,
value: data.pitchDeviation,
color: color,
),
const SizedBox(height: 2),
_buildAngleRow(
label: 'Roll ',
value: data.rollDegrees,
value: data.rollDeviation,
color: color,
),
],