Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add always_publish arg #134

Merged
merged 5 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions python/coral_usb/detector_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ def image_cb(self, msg):
label_names=[self.label_names[lbl] for lbl in labels],
label_proba=scores)

self.pub_rects.publish(rect_msg)
self.pub_class.publish(cls_msg)

if self.enable_visualization:
with self.lock:
self.img = img
Expand All @@ -143,6 +140,11 @@ def image_cb(self, msg):
self.labels = labels
self.scores = scores

if not self.always_publish and len(cls_msg.labels) <= 0:
return
self.pub_rects.publish(rect_msg)
self.pub_class.publish(cls_msg)

def visualize_cb(self, event):
if (not self.visualize or self.img is None or self.encoding is None
or self.header is None or self.bboxes is None
Expand Down
2 changes: 2 additions & 0 deletions python/coral_usb/human_pose_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ def image_cb(self, msg):
label_proba=[np.average(score) for score in scores]
)

if not self.always_publish and len(cls_msg.label_names) <= 0:
return
knorth55 marked this conversation as resolved.
Show resolved Hide resolved
self.pub_pose.publish(poses_msg)
self.pub_rects.publish(rects_msg)
self.pub_class.publish(cls_msg)
Expand Down
5 changes: 5 additions & 0 deletions python/coral_usb/node_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def __init__(self, model_file=None, label_file=None, namespace='~'):
self.timer = rospy.Timer(
rospy.Duration(self.duration), self.visualize_cb)

self.always_publish = rospy.get_param("~always_publish", True)
rospy.loginfo(
"Publish even if object/human_pose is not found : {}".format(
knorth55 marked this conversation as resolved.
Show resolved Hide resolved
self.always_publish))

def subscribe(self):
if self.transport_hint == 'compressed':
self.sub_image = rospy.Subscriber(
Expand Down