BCLab-UNM / SC2

Swarmathon Team Code for the NASA Space Challenge 2 Competition
MIT License
2 stars 0 forks source link

Python3 threading Semaphore changes #163

Closed Carter90 closed 3 years ago

Carter90 commented 3 years ago

While the scoot is technically able to drive I'm concerned

[ERROR] [1614663158.085422, 216.011000]: Error processing request: 'NoneType' object has no attribute 'acquire'
['Traceback (most recent call last):\n', '  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 632, in _handle_request\n    response = convert_return_to_response(self.handler(request), self.response_class)\n', '  File "/home/carter/SC2/src/scoot/src/Driver.py", line 151, in _control\n    while not t.sema.acquire(blocking=False):\n', "AttributeError: 'NoneType' object has no attribute 'acquire'\n"]
abbypribis commented 3 years ago

Commented out in Driver.py:

while not t.sema.acquire(blocking=False):
    rospy.sleep(sleep_wait)
    sleep_turns -= 1
    if sleep_turns == 0:
    # Ugh. Is this safe?
    with package_lock:
         self._stop_now(MoveResult.TIMEOUT)

sema was always set of None, so it couldn't "acquire" anything.

Might cause issues when handling multiple drive commands - keep in mind.