(self)
| 449 | self._start_infer = not self._start_infer |
| 450 | |
| 451 | def loop(self): |
| 452 | if not self._start_infer: |
| 453 | return |
| 454 | |
| 455 | self.get_logger().debug(f"Loop: {self._counter}") |
| 456 | |
| 457 | # Publish motion block data |
| 458 | if self._gen_counter - self._current_block_size - self._counter <= self.future_len: |
| 459 | self._publish_motion_block() |
| 460 | self._gen_motion() |
| 461 | |
| 462 | # Calculate counter based on absolute time since toggle started |
| 463 | if self._toggle_time >= 0: |
| 464 | time0 = self.get_clock().now() |
| 465 | # current_time = time0.seconds + time0.nanoseconds / 1e9 # deprecated usage |
| 466 | current_time = time0.seconds_nanoseconds()[0] + time0.seconds_nanoseconds()[1] / 1e9 |
| 467 | absolute_elapsed = current_time - self._toggle_time |
| 468 | |
| 469 | self._counter = int(np.floor(absolute_elapsed / self.dt)) |
| 470 | |
| 471 | def _gen_motion(self): |
| 472 | t0 = time.time() |
nothing calls this directly
no test coverage detected