Created
June 29, 2018 09:18
-
-
Save shyampurk/5ffd9a62cc53070a6e06c75dc5a895ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def handleEmergencyMessage(client, userdata, msg): | |
print(msg.topic + ' ' + str(msg.payload)) | |
dataReceived = json.loads(msg.payload) | |
gpsLocation[0] = dataReceived["lat"] | |
gpsLocation[1] = dataReceived["lon"] | |
gps_tuple = tuple(gpsLocation) | |
distanceCalculated = int(vincenty(TRAFFIC_SIGNAL, gps_tuple).meters) | |
print ("Emergency Vehicle Location: ", distanceCalculated) | |
if distanceCalculated >= 150: | |
emergencyVehicleState["state"] = 0 | |
trafficLightNormalCurrState = LIGHT_RED | |
else: | |
emergencyVehicleState["state"] = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment