Skip to content

Commit

Permalink
added joust test for hz
Browse files Browse the repository at this point in the history
  • Loading branch information
adangert committed Jan 14, 2021
1 parent fb77ac9 commit 23d13f2
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions controller_process.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from games import ffa, zombie, commander, swapper, tournament, speed_bomb, fight_club
import common, colors, joust, webui, piparty
#this should all be refactored to use the same options per game
#this file is used for multiprocessing
def main_track_move(menu, restart, move_serial, move_num, move_opts, force_color, battery, dead_count, game_mode, \
team, team_color_enum, controller_sensitivity, dead_move, music_speed, werewolf_reveal, show_team_colors, red_on_kill, zombie_opt,\
commander_intro, commander_move_opt, commander_powers, commander_overdrive,five_controller_opt, swapper_team_colors,\
Expand Down
File renamed without changes.
66 changes: 66 additions & 0 deletions joust_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#This is testing joust controller latency and hz and frame buffer
#basic results:
#old psmove controller approx 88 hz for each recieved message
#two frames per message so approx 176 hz
#buffer of 64-65 new messages held when doing move.poll()

#new move controller!
#approx 790 hz! first and second frames are the same
#around 90 -160 held in buffer


import sys
import os
import time
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'build'))

import psmove

if psmove.count_connected() < 1:
print('No controller connected')
sys.exit(1)

psmoves = [psmove.PSMove(x) for x in range(psmove.count_connected())]
print(psmoves)
print(psmoves[0].get_serial())

move = psmoves[0]

#if move.connection_type != psmove.Conn_Bluetooth:
# print('Please connect controller via Bluetooth')
# sys.exit(1)

#assert move.has_calibration()
counter = 0
timer = time.time()
avger = []
while counter < 1000:
a = move.poll()
counter = 0
while a:
time_since_last = time.time() - timer
avger.append(time_since_last)
timer = time.time()
print(time_since_last)
print(str(1/(sum(avger)/len(avger)))+" hz")
counter += 1
#print("got the poll")
print(a)
ax, ay, az = move.get_accelerometer_frame(psmove.Frame_SecondHalf)
gx, gy, gz = move.get_gyroscope_frame(psmove.Frame_SecondHalf)
ax2, ay2, az2 = move.get_accelerometer_frame(psmove.Frame_FirstHalf)
gx2, gy2, gz2 = move.get_gyroscope_frame(psmove.Frame_FirstHalf)
print( 'A: %5.2f %5.2f %5.2f ' % (ax, ay, az))
print('G: %6.2f %6.2f %6.2f ' % (gx, gy, gz))
print( 'A: %5.2f %5.2f %5.2f ' % (ax2, ay2, az2))
print('G: %6.2f %6.2f %6.2f ' % (gx2, gy2, gz2))
a = move.poll()
#print("bloop")
print(counter)
#print("now to sleeeep\n\n\n")
#time.sleep(0.75)
time.sleep(4)




0 comments on commit 23d13f2

Please sign in to comment.