Skip to content

Commit

Permalink
Add printout of FPS
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-keenan committed May 26, 2017
1 parent a3a275f commit b0a9314
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
Binary file modified code/__pycache__/decision.cpython-35.pyc
Binary file not shown.
Binary file modified code/__pycache__/perception.cpython-35.pyc
Binary file not shown.
Binary file modified code/__pycache__/supporting_functions.cpython-35.pyc
Binary file not shown.
6 changes: 4 additions & 2 deletions code/drive_rover.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,21 @@ def __init__(self):
frame_counter = 0
# Initalize second counter
second_counter = time.time()
fps = None


# Define telemetry function for what to do with incoming data
@sio.on('telemetry')
def telemetry(sid, data):

global frame_counter, second_counter
global frame_counter, second_counter, fps
frame_counter+=1
# Do a rough calculation of frames per second (FPS)
if (time.time() - second_counter) > 1:
print ("Current FPS: {}".format(frame_counter))
fps = frame_counter
frame_counter = 0
second_counter = time.time()
print("Current FPS: {}".format(fps))

if data:
global Rover
Expand Down
3 changes: 2 additions & 1 deletion code/supporting_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def update_rover(Rover, data):
Rover.picking_up = np.int(data["picking_up"])

print('speed =',Rover.vel, 'position =', Rover.pos, 'throttle =',
Rover.throttle, 'steer_angle =', Rover.steer, 'near_sample', Rover.near_sample, data["picking_up"])
Rover.throttle, 'steer_angle =', Rover.steer, 'near_sample', Rover.near_sample,
'picking_up', data["picking_up"])

# Get the current image from the center camera of the rover
imgString = data["image"]
Expand Down

0 comments on commit b0a9314

Please sign in to comment.