face_detector for care-o-bot 4 not working as expected

asked 2021-03-15 11:11:24 -0500

redaM gravatar image

I am trying to use face_detector on the care-o-bot 4. I created the following launch file following a tutorial found on YouTube that is intended to simply return the position of a face by subscribing to people_tracker_measurements_array.

<launch>
    <arg name="camera" default="sensorring_cam3d" />
    <arg name="rgb_ns" default="rgb" />
    <arg name="depth_ns" default="depth" />
    <arg name="image_topic" default="image_raw" />
    <arg name="depth_topic" default="points" />
    <arg name="fixed_frame" default="sensorring_cam3d" />

    <node pkg="face_detector" type="face_detector" name="face_detector" output="screen">
            <remap from="camera" to="$(arg camera)" />
            <remap from="image_topic" to="$(arg image_topic)" />
            <remap from="rgb_ns" to="$(arg rgb_ns)" />
            <remap from="depth_topic" to="$(arg depth_topic)" />
            <remap from="depth_ns" to="$(arg depth_ns)" />
            <param name="fixed_frame" type="string" value="$(arg fixed_frame)" />

            <param name="classifier_name" type="string" value="frontalface" />
            <rosparam command="load" file="$(find face_detector)/param/classifier.yaml"/>
            <param name="classifier_reliability" type="double" value="0.9"/>
            <param name="do_continuous" type="bool" value="true" />
            <param name="do_publish_faces_of_unknown_size" type="bool" value="false" />
            <param name="do_display" type="bool" value="false" />
            <param name="use_rgbd" type="bool" value="true" />
            <param name="approximate_sync" type="bool" value="true" />
    </node>

    <node pkg="my_face_detector" type="face_detector_client.py" name="face_detection_client_start_node" output="screen">
    </node>

</launch>

And the following client in Python:

#!/usr/bin/env python

import rospy
from people_msgs.msg import PositionMeasurementArray

class FaceDetectClient(object):
    def __init__(self):
            self.face_detect_subs = rospy.Subscriber("/face_detector/people_tracker_measurements_array",
                                                            PositionMeasurementArray,
                                                            self.face_detect_subs_callback)

            self.pos_measurement_array = PositionMeasurementArray()

    def face_detect_subs_callback(self, msg):
            self.pos_measurement_array = msg


def Face_DetectionClient_Start():
    rospy.init_node("face_detection_client_start_node")

    while not rospy.Time.now():
            pass

    face_detector_client = FaceDetectClient()

    rospy.spin()


if __name__ == "__main__":
    Face_DetectionClient_Start()

As I read from another answer on here, I need to make sure that I'm subscribed to the right topics and based on the following output of rosnode info /face_detector, I am because there is no [unknown type] for any of the camera and depth topics:

Node [/face_detector]
Publications: 
* /face_detector/faces_cloud [sensor_msgs/PointCloud]
* /face_detector/feedback [face_detector/FaceDetectorActionFeedback]
* /face_detector/people_tracker_measurements_array [people_msgs/PositionMeasurementArray]
* /face_detector/result [face_detector/FaceDetectorActionResult]
* /face_detector/status [actionlib_msgs/GoalStatusArray]
* /rosout [rosgraph_msgs/Log]
Subscriptions: 
* /face_detector/cancel [unknown type]
* /face_detector/goal [unknown type]
* /sensorring_cam3d/depth/camera_info [sensor_msgs/CameraInfo]
* /sensorring_cam3d/depth/points [sensor_msgs/PointCloud2]
* /sensorring_cam3d/rgb/camera_info [sensor_msgs/CameraInfo]
* /sensorring_cam3d/rgb/image_raw [sensor_msgs/Image]
* /tf [tf2_msgs/TFMessage]
* /tf_static [tf2_msgs/TFMessage]

My question is, what am I doing wrong here? I can see there's an unknown type for cancel and goal but I don't believe I subscribe to these topics. Is that the issue with my code, or is it something else? Another thing I suspect it may be, is what I wrote for the fixed_frame argument. The default launch file from face_detector specifies <arg name="fixed_frame" default="camera_rgb_optical_frame" /> and I'm not sure how to find out which one to use for the care-o-bot, I arbitrarily chose sensorring_cam3d as can be seen in the launch file, because it is the camera I am using.

Any help or clarification here is much appreciated. Thank you in advance ... (more)

edit retag flag offensive close merge delete