Skip to content

Commit

Permalink
Add counter to process movement every n frames
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulooh007 committed Oct 10, 2023
1 parent 75bb492 commit e31c8de
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dronenet_landing/sn2_landing_algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ def drawQuadrant():

set_flight_mode('GUIDED')

counter = 0
n_frame = 30


# Take off procedure
while True:
Expand Down Expand Up @@ -348,8 +351,9 @@ def drawQuadrant():

cv2.line(frame, (cX, cY), (centerX,centerY), (254, 255, 0), 3)

if error > 50:
send_body_offset_ned_command(x_ang, y_ang, 0, velocity= True)
if counter % n_frame == 0:
if error > 50:
send_body_offset_ned_command(x_ang, y_ang, 0, velocity= True)

else:
x_ang, y_ang = 0, 0
Expand All @@ -360,7 +364,7 @@ def drawQuadrant():
0.5, (0, 0, 244), 2)



counter += 1
cv2.imshow('video',frame)
debug_image_writer.write(frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
Expand Down

0 comments on commit e31c8de

Please sign in to comment.