@@ -107,6 +107,7 @@ def camera_callback(self, msg):
107
107
function will detect faces in the image and publish information about
108
108
them to the /face_detection topic.
109
109
"""
110
+ self .get_logger ().debug ("Received image" )
110
111
self .is_on_lock .acquire ()
111
112
is_on = self .is_on
112
113
self .is_on_lock .release ()
@@ -161,23 +162,30 @@ def camera_callback(self, msg):
161
162
annotated_img = annotated_msg
162
163
# Publish the detected mouth center. The below is a hardcoded
163
164
# rough position of the mouth from the side staging location,
164
- # in "camera_color_optical_frame." We add 5cm of noise to the
165
+ # in "camera_color_optical_frame." We add +/- 5cm of noise to the
165
166
# position for added realism
167
+ # head_position_from_staging_location = [0.044, -0.130, 0.654]
168
+ head_position_from_staging_location = [0.04196 , - 0.11682 , 0.58047 ]
166
169
face_detection_msg .detected_mouth_center = PointStamped ()
167
170
face_detection_msg .detected_mouth_center .header = msg .header
168
171
face_detection_msg .detected_mouth_center .point .x = (
169
- 0.044 + (np .random .rand () - 0.5 ) / 10
172
+ head_position_from_staging_location [0 ]
173
+ + (2 * np .random .rand () - 1 ) * 0.05
170
174
)
171
175
face_detection_msg .detected_mouth_center .point .y = (
172
- - 0.130 + (np .random .rand () - 0.5 ) / 10
176
+ head_position_from_staging_location [1 ]
177
+ + (2 * np .random .rand () - 1 ) * 0.05
173
178
)
174
179
face_detection_msg .detected_mouth_center .point .z = (
175
- 0.654 + (np .random .rand () - 0.5 ) / 10
180
+ head_position_from_staging_location [2 ]
181
+ + (2 * np .random .rand () - 1 ) * 0.05
176
182
)
177
183
else :
184
+ face_detection_msg .detected_mouth_center .header = msg .header
178
185
annotated_img = msg
179
186
face_detection_msg .is_mouth_open = open_mouth_detected
180
187
self .publisher_results .publish (face_detection_msg )
188
+ self .get_logger ().info ("Published face detection" )
181
189
self .publisher_image .publish (annotated_img )
182
190
183
191
0 commit comments