Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request udacity#33 from Team-Autobots-SDC/feature/fix-brid…
Browse files Browse the repository at this point in the history
…ge-error

Fix for bridge race condition
  • Loading branch information
spicavigo authored Sep 16, 2017
2 parents f3078ec + ccc3f2c commit d58054e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions ros/src/styx/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@


class Bridge(object):
def __init__(self, conf):
def __init__(self, conf, server):
rospy.init_node('styx_server')
self.server = server
self.vel = 0.
self.yaw = None
self.angular_vel = 0.
Expand All @@ -55,9 +56,6 @@ def __init__(self, conf):
self.publishers = {e.name: rospy.Publisher(e.topic, TYPE[e.type], queue_size=1)
for e in conf.publishers}

def register_server(self, server):
self.server = server

def create_light(self, x, y, z, yaw, state):
light = TrafficLight()

Expand Down
3 changes: 1 addition & 2 deletions ros/src/styx/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

sio = socketio.Server()
app = Flask(__name__)
bridge = Bridge(conf)
msgs = []

dbw_enable = False
Expand All @@ -25,7 +24,7 @@ def send(topic, data):
msgs.append((topic, data))
#sio.emit(topic, data=json.dumps(data), skip_sid=True)

bridge.register_server(send)
bridge = Bridge(conf, send)

@sio.on('telemetry')
def telemetry(sid, data):
Expand Down

0 comments on commit d58054e

Please sign in to comment.