Skip to content

Check if the debug image has not been deleted before publishing #315

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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: 8 additions & 0 deletions wild_visual_navigation/traversability_estimator/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ def clear_debug_data(self):
print(e)
pass # Image already removed

def has_debug_data(self):
return (
hasattr(self, "_image")
and self._image is not None
and hasattr(self, "_supervision_mask")
and self._supervision_mask is not None
)

def change_device(self, device):
"""Changes the device of all the class members

Expand Down
5 changes: 4 additions & 1 deletion wild_visual_navigation_ros/scripts/wvn_learning_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def visualize_image_overlay(self):
vis_node = self._traversability_estimator.get_mission_node_for_visualization()

# Publish reprojections of last node in graph
if vis_node is not None:
if vis_node is not None and vis_node.has_debug_data():
cam = vis_node.camera_name
torch_image = vis_node._image
torch_mask = vis_node._supervision_mask
Expand All @@ -841,6 +841,9 @@ def visualize_image_overlay(self):
image_out = self._visualizer.plot_detectron_classification(torch_image, torch_mask, cmap="Blues")
self._camera_handler[cam]["debug"]["image_overlay"].publish(rc.numpy_to_ros_image(image_out))

elif vis_node is not None:
rospy.logwarn(f"[{self._node_name}] No visualization data available for node")

def pause_learning_callback(self, req):
"""Start and stop the network training"""
prev_state = self._traversability_estimator.pause_learning
Expand Down
Loading