Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 3570fd86 authored by Francesco Tonini's avatar Francesco Tonini
Browse files

Improve diagnostic

parent b4549957
No related branches found
No related tags found
1 merge request!4Update submodules and add timestamp
......@@ -307,7 +307,7 @@ class SoftBiometricsEstimation:
self.diagnostic_pub.publish(diagnostic_msgs)
def _send_diagnostic(self):
diagnostic_msgs = DiagnosticArray()
diagnostic_values = []
for face_id, face in self.faces.items():
if "data" not in face.keys():
continue
......@@ -329,18 +329,22 @@ class SoftBiometricsEstimation:
age = round(sum(age) / len(age))
gender = round(sum(gender) / len(gender))
gender_value = KeyValue(
key="gender", value="female" if gender == 1 else "male"
)
age_value = KeyValue(key="age", value=str(age))
msg = DiagnosticStatus(
level=DiagnosticStatus.OK,
name=f"Social perception: Face detection: Soft biometrics: {face_id}",
values=[gender_value, age_value],
diagnostic_values.append(
KeyValue(
key=f"Face ID {face_id}",
value=f"{'female' if gender == 1 else 'male'} - {age}",
)
)
diagnostic_msgs.status.append(msg)
diagnostic_msgs = DiagnosticArray(
status=[
DiagnosticStatus(
level=DiagnosticStatus.OK,
name="Social perception: Face detection: Soft biometrics",
values=diagnostic_values,
)
]
)
diagnostic_msgs.header.stamp = rospy.Time.now()
self.diagnostic_pub.publish(diagnostic_msgs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment