def incremental_callback(self, msg):
     """accumulate all data until consent is requested and accepted"""
     if self._flag_robot and self._flag_rgb and self._flag_depth and self.requested_consent_flag is 0:
         if msg.uuid in self.sk_mapping:
             if self.sk_mapping[msg.uuid]["state"] is 'Tracking' and len(self.accumulate_data[msg.uuid]) <= self.max_num_frames:
                     self.accumulate_data[msg.uuid].append(msg)
                     robot_msg = robot_message(robot_pose = self.robot_pose, PTU_pan = self.ptu_pan, PTU_tilt = self.ptu_tilt)
                     self.accumulate_robot[msg.uuid].append(robot_msg)
                     self.accumulate_rgb_images[msg.uuid].append(self.rgb)
                     #self.accumulate_rgb_sk_images[msg.uuid].append(self.rgb_sk)
                     self.accumulate_depth_images[msg.uuid].append(self.xtion_img_d_rgb)
 def incremental_callback(self, msg):
     """accumulate the multiple skeleton messages until user goes out of scene"""
     if self._flag_robot and self._flag_rgb and self._flag_depth:
         if msg.uuid in self.sk_mapping:
             if self.sk_mapping[msg.uuid]["state"] is "Tracking":
                 if len(self.accumulate_data[msg.uuid]) < self.max_num_frames:
                     self.accumulate_data[msg.uuid].append(msg)
                     robot_msg = robot_message(
                         robot_pose=self.robot_pose, PTU_pan=self.ptu_pan, PTU_tilt=self.ptu_tilt
                     )
                     self.accumulate_robot[msg.uuid].append(robot_msg)
                     self._dump_images(msg)
Exemplo n.º 3
0
    def incremental_callback(self, msg):
        """accumulate the multiple skeleton messages until user goes out of scene"""
        if self.action_called:
            if self._flag_robot:  # and self._flag_rgb and self._flag_depth:
                if msg.uuid in self.sk_mapping:
                    if self.sk_mapping[msg.uuid]["state"] is 'Tracking' and len(self.accumulate_data[msg.uuid]) < self.max_num_frames \
                    and msg.joints[0].pose.position.z > self.dist_thresh:

                        self.sk_mapping[msg.uuid]["msgs_recieved"] += 1
                        if self.sk_mapping[msg.uuid][
                                "msgs_recieved"] % self.reduce_frame_rate_by == 0:
                            self.accumulate_data[msg.uuid].append(msg)
                            robot_msg = robot_message(
                                robot_pose=self.robot_pose,
                                PTU_pan=self.ptu_pan,
                                PTU_tilt=self.ptu_tilt)
                            self.accumulate_robot[msg.uuid].append(robot_msg)
    def incremental_callback(self, msg):
        """accumulate all data until consent is requested and accepted"""
        if self._flag_robot and self._flag_rgb and self._flag_depth and self.requested_consent_flag is 0:
            if msg.uuid in self.sk_mapping:
                if self.sk_mapping[msg.uuid]["state"] is 'Tracking' and len(self.accumulate_data[msg.uuid]) <= self.max_num_frames \
                and msg.joints[0].pose.position.z > self.dist_thresh:

                    self.sk_mapping[msg.uuid]["msgs_recieved"] += 1
                    if self.sk_mapping[msg.uuid][
                            "msgs_recieved"] % self.reduce_frame_rate_by == 0:
                        self.accumulate_data[msg.uuid].append(msg)
                        robot_msg = robot_message(robot_pose=self.robot_pose,
                                                  PTU_pan=self.ptu_pan,
                                                  PTU_tilt=self.ptu_tilt)
                        self.accumulate_robot[msg.uuid].append(robot_msg)
                        self.accumulate_rgb_images[msg.uuid].append(self.rgb)
                        #self.accumulate_rgb_sk_images[msg.uuid].append(self.rgb_sk)
                        self.accumulate_depth_images[msg.uuid].append(
                            self.xtion_img_d_rgb)
Exemplo n.º 5
0
    def run_offline_instead_of_callback(self, vid=""):

        if vid != "":
            d_video = os.path.join(self.offline_directory, vid)
            d_sk = os.path.join(d_video, 'skeleton')
            d_robot = os.path.join(d_video, 'robot')
            sk_files = [
                f for f in sorted(os.listdir(d_sk))
                if os.path.isfile(os.path.join(d_sk, f))
            ]
            r_files = [
                f for f in sorted(os.listdir(d_robot))
                if os.path.isfile(os.path.join(d_robot, f))
            ]

            self.accumulate_data[vid], self.accumulate_robot[vid] = [], []
            for _file in sorted(sk_files):

                frame = int(_file.replace(".txt", ""))
                sk = get_sk_info(open(os.path.join(d_sk, _file),
                                      'r'))  # old ECAI data format.
                r = get_rob_info(open(os.path.join(d_robot, _file), 'r'))

                joints_msgs = [
                    joint_message(name=n,
                                  pose=Pose(Point(j[0], j[1], j[2]),
                                            Quaternion(0, 0, 0, 1)))
                    for n, j in sk.items()
                ]
                robot_pose = Pose(
                    Point(r[0][0], r[0][1], r[0][2]),
                    Quaternion(r[1][0], r[1][1], r[1][2], r[1][3]))

                self.accumulate_data[vid].append(
                    skeleton_message(userID=1, joints=joints_msgs, time=frame))
                self.accumulate_robot[vid].append(
                    robot_message(
                        robot_pose=robot_pose,
                        PTU_pan=0,
                        PTU_tilt=10 * math.pi /
                        180.))  # pan tilt set to (0, 10) for ecai dataset