(self, data)
| 71 | logger.error("Failed to initialize rzctl") |
| 72 | |
| 73 | def process_data(self, data): |
| 74 | if isinstance(data, sv.Detections): |
| 75 | xyxy = data.xyxy[0] |
| 76 | target_x = (xyxy[0] + xyxy[2]) / 2 |
| 77 | target_y = (xyxy[1] + xyxy[3]) / 2 |
| 78 | target_w = xyxy[2] - xyxy[0] |
| 79 | target_h = xyxy[3] - xyxy[1] |
| 80 | target_cls = data.class_id[0] if data.class_id is not None and data.class_id.size > 0 else None |
| 81 | else: |
| 82 | target_x, target_y, target_w, target_h, target_cls = data |
| 83 | |
| 84 | shooting_state = self.get_shooting_key_state() |
| 85 | self.visualize_target(target_x, target_y, target_cls) |
| 86 | self.bScope = self.check_target_in_scope(target_x, target_y, target_w, target_h, self.bScope_multiplier) if cfg.auto_shoot or cfg.triggerbot else False |
| 87 | self.bScope = cfg.force_click or self.bScope |
| 88 | |
| 89 | if not self.disable_prediction: |
| 90 | current_time = time.time() |
| 91 | if not isinstance(data, sv.Detections): |
| 92 | target_x, target_y = self.predict_target_position(target_x, target_y, current_time) |
| 93 | self.visualize_prediction(target_x, target_y, target_cls) |
| 94 | |
| 95 | move_x, move_y = self.calc_movement(target_x, target_y, target_cls) |
| 96 | |
| 97 | self.visualize_history(target_x, target_y) |
| 98 | shooting.submit(self.bScope, shooting_state) |
| 99 | self.move_mouse(move_x, move_y, shooting_state) |
| 100 | |
| 101 | def predict_target_position(self, target_x, target_y, current_time): |
| 102 | # First target |
no test coverage detected