Skip to content

Commit

Permalink
Debugging pose data recorder
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguelmelon committed May 28, 2024
1 parent fa9141a commit 125981c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
8 changes: 4 additions & 4 deletions people_tracking_v2/scripts/pose_estimation_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from sensor_msgs.msg import Image

from people_tracking.yolo_pose_wrapper import YoloPoseWrapper
from people_tracking_v2.msg import PoseDistance
from people_tracking_v2.msg import BodySize

class PoseEstimationNode:
def __init__(
Expand Down Expand Up @@ -69,7 +69,7 @@ def __init__(
self._recognize_srv = rospy.Service("recognize", Recognize, self._recognize_srv)
self._image_subscriber = rospy.Subscriber("/Webcam/image_raw", Image, self._image_callback)
self._recognitions_publisher = rospy.Publisher("/pose_recognitions", Recognitions, queue_size=10)
self._pose_distance_publisher = rospy.Publisher("/pose_distances", PoseDistance, queue_size=10)
self._pose_distance_publisher = rospy.Publisher("/pose_distances", BodySize, queue_size=10)
if self._topic_publish_result_image or self._service_publish_result_image:
self._result_image_publisher = rospy.Publisher("/pose_result_image", Image, queue_size=10)

Expand All @@ -92,7 +92,7 @@ def _image_callback(self, image_msg):
# Calculate distances and publish them
for pose in pose_details:
try:
pose_distance_msg = PoseDistance()
pose_distance_msg = BodySize()
pose_distance_msg.header.stamp = rospy.Time.now()
if "LShoulder" in pose and "LHip" in pose:
pose_distance_msg.left_shoulder_hip_distance = self._wrapper.compute_distance(pose["LShoulder"], pose["LHip"])
Expand Down Expand Up @@ -148,7 +148,7 @@ def _get_recognitions(self, image_msg, save_images, publish_images):
# Calculate distances and log them
for pose in pose_details:
try:
pose_distance_msg = PoseDistance()
pose_distance_msg = BodySize()
pose_distance_msg.header.stamp = rospy.Time.now()
if "LShoulder" in pose and "LHip" in pose:
pose_distance_msg.left_shoulder_hip_distance = self._wrapper.compute_distance(pose["LShoulder"], pose["LHip"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<node
pkg="people_tracking_v2"
type="save-HoC-data.py"
type="save_HoC_data.py"
name="Operator_HoC"
output="screen"
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!-- <arg name="laptop" default="True" /> -->
<!-- <arg name="depth_camera" default="False" /> -->
<!-- <arg name="save_data" default="False"/> -->

<launch>
<node
pkg="cv_camera"
type="cv_camera_node"
name="Webcam"
output="screen"
/>

<node
pkg="people_tracking_v2"
type="pose_estimation_node.py"
name="Pose"
output="screen"
/>

<node
pkg="people_tracking_v2"
type="save_pose_data.py"
name="Operator_pose"
output="screen"
/>

</launch>
4 changes: 2 additions & 2 deletions people_tracking_v2/tools/save_pose_data.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import rospy
import numpy as np
from people_tracking_v2.msg import PoseDistance
from people_tracking_v2.msg import BodySize
import os

class SavePoseDataNode:
Expand All @@ -11,7 +11,7 @@ def __init__(self):
rospy.init_node('save_pose_data_node', anonymous=True)

# Subscriber to pose distance data
self.pose_sub = rospy.Subscriber('/pose_distances', PoseDistance, self.pose_callback)
self.pose_sub = rospy.Subscriber('/pose_distances', BodySize, self.pose_callback)

# File to save pose data
self.pose_data_file = os.path.expanduser('~/pose_data/pose_data.npz')
Expand Down

0 comments on commit 125981c

Please sign in to comment.