Skip to content

Commit

Permalink
Pushed competition code
Browse files Browse the repository at this point in the history
  • Loading branch information
Yajirushi12 committed Jun 8, 2019
2 parents a1baec7 + 55e82f5 commit b2113fc
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 42 deletions.
7 changes: 6 additions & 1 deletion autonomy_main_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,14 @@ def set_gps_waypoint():
# distance = 2 # for testing, comment out later
if distance < .5:
rovecomm_node.write(drive.send_drive(0, 0))
state_switcher.handle_event(rs.AutonomyEvents.REACHED_MARKER, rs.ApproachingMarker(), then=logging.info("Reached Marker")) # commented for testing, remove the commenting for running

# rovecomm_node.write(RoveCommPacket(1000, 'h', (0,0), ip_octet_4=140))
# state_switcher.handle_event(rs.AutonomyEvents.REACHED_MARKER, rs.ApproachingMarker(), then=logging.info("Reached Marker")) # commented for testing, remove the commenting for running


with open(outString, 'a') as f:
f.write(time.strftime("%H%M%S") + " ApproachingMarker: Reached Marker, entering Idle()\n")

notify.notify_finish()
continue
else:
Expand Down
79 changes: 38 additions & 41 deletions drivers/notify.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
import time
import struct

from drivers.rovecomm import RoveCommEthernetUdp, RoveCommPacket


DRIVE_BOARD_IP = "192.168.1.142"
NOTIFY_ID = 7000


class Notify:

def __init__(self, rove_comm):
self.rove_comm_node = rove_comm

def _notify(self, val):
self.rove_comm_node.write(RoveCommPacket(NOTIFY_ID, 'b', (val,0), ip_octet_4='142'))

def notify_finish(self):
self._notify(50)
time.sleep(1)
self._notify(0)
time.sleep(1)
self._notify(50)
time.sleep(1)
self._notify(0)
time.sleep(1)
self._notify(50)
time.sleep(1)
self._notify(0)
time.sleep(1)
self._notify(50)
time.sleep(5)
self._notify(0)


if __name__ == '__main__':
rove_comm_node = RoveCommEthernetUdp("oof.txt")
notify = Notify(rove_comm_node)

notify.notify_finish()
import time
import struct

from drivers.rovecomm import RoveCommEthernetUdp, RoveCommPacket


DRIVE_BOARD_IP = "192.168.1.142"
NOTIFY_ID = 7000


class Notify:

def __init__(self, rove_comm):
self.rove_comm_node = rove_comm

def _notify(self, val):
self.rove_comm_node.write(RoveCommPacket(NOTIFY_ID, 'b', (val,0), ip_octet_4='142'))

def notify_finish(self):
self._notify(50)
time.sleep(1)
self._notify(0)
time.sleep(1)
self._notify(50)
time.sleep(1)
self._notify(0)
time.sleep(1)
self._notify(50)
time.sleep(5)
self._notify(0)


if __name__ == '__main__':
rove_comm_node = RoveCommEthernetUdp("oof.txt")
notify = Notify(rove_comm_node)

notify.notify_finish()

0 comments on commit b2113fc

Please sign in to comment.