Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def acc_compute(self,):
- """
- Compute acc
- """
- import numpy as np
- from step_counting import step_counting
- self.acc_data = {"x": [], "y": [], "z": []}
- print("Starting acc compute")
- while self.running.is_set():
- try:
- acc = self.compute_acc_queue.get(timeout=5)
- for idx, axe in enumerate("xyz"):
- self.acc_data[axe] += acc[idx]
- if len(self.acc_data["x"]) < (10 * params.ACC_FREQ):
- continue
- ar = np.array(
- [
- (
- self.acc_data["x"][idx],
- self.acc_data["y"][idx],
- self.acc_data["z"][idx],
- )
- for idx in range(len(self.acc_data["x"]))
- ]
- )
- ## DO WHAT YOU WANT WITH YOUR ACC_DATA HERE
- except Queue.Empty:
- time.sleep(0.1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement