Skip to content

Commit

Permalink
Merge pull request #112 from MelbourneHighSchoolRobotics/event_fix
Browse files Browse the repository at this point in the history
Ensure event queue is instantiated regardless of attached code.
  • Loading branch information
glipR authored Sep 16, 2020
2 parents 336199e + e95de12 commit f0d6702
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ev3sim/robot.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from queue import Queue
from ev3sim.simulation.interactor import IInteractor
from ev3sim.simulation.loader import ScriptLoader
from ev3sim.simulation.world import stop_on_pause
Expand Down Expand Up @@ -48,6 +49,7 @@ def initialise_bot(topLevelConfig, filename, prefix):
)
robot.ID = prefix
ScriptLoader.instance.robots[prefix] = robot
ScriptLoader.instance.data["events"][robot.ID] = Queue()
except yaml.YAMLError as exc:
print(f"An error occurred while loading robot preset {filename}. Exited with error: {exc}")

Expand Down
1 change: 0 additions & 1 deletion ev3sim/simulation/communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def start_server_with_shared_data(data, result, bind_addr):
class SimulationDealer(ev3sim.simulation.comm_schema_pb2_grpc.SimulationDealerServicer):
def RequestTickUpdates(self, request, context):
rob_id = request.robot_id
data["events"][rob_id] = Queue()
if rob_id not in data["active_count"]:
data["active_count"][rob_id] = 0
data["active_count"][rob_id] += 1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setup(
name="ev3sim",
version="1.3.0",
version="1.3.1",
description="Simulate ev3dev programs in Python",
long_description=README,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit f0d6702

Please sign in to comment.