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

Fix/enable service state and class id enumeration #73

Closed
wants to merge 4 commits into from
Closed
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
9 changes: 6 additions & 3 deletions yolo_ros/yolo_ros/yolo_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,11 @@ def on_shutdown(self, state: LifecycleState) -> TransitionCallbackReturn:
def enable_cb(
self, request: SetBool.Request, response: SetBool.Response
) -> SetBool.Response:
self.enable = request.data
response.success = True
if self.enable != request.data: # Only change state if it's different
self.enable = request.data
response.success = True
else:
response.success = False # Indicate no change was made
return response

def parse_hypothesis(self, results: Results) -> List[Dict]:
Expand Down Expand Up @@ -360,7 +363,7 @@ def image_cb(self, msg: Image) -> None:
aux_msg = Detection()

if results.boxes or results.obb and hypothesis and boxes:
aux_msg.class_id = hypothesis[i]["class_id"]
aux_msg.class_id = i + 1 # hypothesis[i]["class_id"]
aux_msg.class_name = hypothesis[i]["class_name"]
aux_msg.score = hypothesis[i]["score"]

Expand Down