Skip to content

Commit

Permalink
Undid the ReactiveRefactor listener-queue
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvrajan committed Feb 13, 2016
1 parent e4f7c80 commit b6000d2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
3 changes: 0 additions & 3 deletions py/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
from grt.mechanism.manual_shooter import ManualShooter
from queue import Queue

# Robot Listener Queue
listener_queue = Queue()

#Compressor initialization
c = Compressor()
c.start()
Expand Down
3 changes: 1 addition & 2 deletions py/grt/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ def update_state(self, state_id, datum):
# copy allows listeners to be removed without throwing an error
self.listeners_temp = self.listeners.copy()
for l in self.listeners_temp:
config.listener_queue.put((self, l, state_id, datum))
del self.listeners_temp
l(self, state_id, datum)

def poll(self):
"""
Expand Down
13 changes: 0 additions & 13 deletions py/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def __init__(self):
self.navx = config.navx
self.achange_motor = config.pickup_achange_motor2

self.listener_queue = config.listener_queue

def disabled(self):
while self.isDisabled():
Expand All @@ -33,19 +32,7 @@ def autonomous(self):
pass

def operatorControl(self):
poll_thread = threading.Thread(target=self.loop)
poll_thread.start()

while self.isOperatorControl() and self.isEnabled():
try:
# listener, state_id, datum = self.process_stack.pop()
sensor, listener, state_id, datum = self.listener_queue.get()
print(state_id, datum)
listener(sensor, state_id, datum)
except IndexError:
pass

def loop(self):
while self.isOperatorControl() and self.isEnabled():
tinit = time.time()
self.hid_sp.poll()
Expand Down

3 comments on commit b6000d2

@proan
Copy link

@proan proan commented on b6000d2 Feb 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use branches for development. I also recommend pull requests and issues.

@dhruvrajan
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Phil,

Thanks for the reminder. I had originally made these changes in the Reactive Refactor branch, and then merged them into master (since they worked properly), but later on, I found out that they were damaging to other parts of the code, so I then removed them from master. Henceforth, we will use pull requests when we merge branches into master.

@proan
Copy link

@proan proan commented on b6000d2 Feb 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, everyone has to roll back commits at one time or another. In your case, it sounds like you don't have enough tests running before you merge.

Second, rolling back changes is one way to solve the problem, but if you added a useful feature, you should try to find the bugs in the system instead of simply reverting. I know that at this time it may be necessary to roll back so that the rest of the team can continue to work.

Please sign in to comment.