Thanks for the excellent work!
I am confused that in "spacemouse_shared_memory.py", when is "ring_buffer.put" excuted? Suppose I keep move the 3D spacemouse, then the event will always be "SpnavMotionEvent" and will never put the command into buffer?
I think i must be wrong but i am really confused now, thanks for the answers!
The correlated codes:
while not self.stop_event.is_set():
event = spnav_poll_event()
receive_timestamp = time.time()
if isinstance(event, SpnavMotionEvent):
motion_event[:3] = event.translation
motion_event[3:6] = event.rotation
motion_event[6] = event.period
elif isinstance(event, SpnavButtonEvent):
button_state[event.bnum] = event.press
else:
finish integrating this round of events
# before sending over
self.ring_buffer.put({
'motion_event': motion_event,
'button_state': button_state,
'receive_timestamp': receive_timestamp
})
time.sleep(1/self.frequency)
Thanks for the excellent work! I am confused that in "spacemouse_shared_memory.py", when is "ring_buffer.put" excuted? Suppose I keep move the 3D spacemouse, then the event will always be "SpnavMotionEvent" and will never put the command into buffer? I think i must be wrong but i am really confused now, thanks for the answers!
The correlated codes: while not self.stop_event.is_set(): event = spnav_poll_event() receive_timestamp = time.time() if isinstance(event, SpnavMotionEvent): motion_event[:3] = event.translation motion_event[3:6] = event.rotation motion_event[6] = event.period elif isinstance(event, SpnavButtonEvent): button_state[event.bnum] = event.press else:
finish integrating this round of events