Exemple #1
0
 def sendPositionDataZero(self, longitude, latitude, altitude, heading,
                          accX, accY, accZ, gyroX, gyroY, gyroZ):
     """
     Send gps data for the tricc-kit pi zero
     :param longitude: Longitude of gps stamp (float)
     :param latitude:  Latitude of gps stamp (float)
     :param altitude:  Altitude of gps stamp (float)
     :param heading:  Heading of the gps stamp (float)
     :param accX: X component of the acceleration (float)
     :param accY: Y component of the acceleration (float)
     :param accZ: Z component of the acceleration (float)
     :param gyroX: X Component of the gyroscope (float)
     :param gyroY: Y Component of the gyroscope (float)
     :param gyroZ: Z Component of the gyroscope (float)
     """
     positionData = tricc.PositionData()
     positionData.header.CopyFrom(self.__createHeader("PositionZero"))
     positionData.longitude = longitude
     positionData.latitude = latitude
     positionData.altitude = altitude
     positionData.heading = heading
     positionData.acceleration.CopyFrom(
         self.__createAcceleration(accX, accY, accZ))
     positionData.gyro.CopyFrom(self.__createGyro(gyroX, gyroY, gyroZ))
     self.mqtt.publish(positionData.header.topic,
                       bytearray(positionData.SerializeToString()))
Exemple #2
0
def handlePositionZeroMsg(data, mqttClient):
    """
    Received a message with gps data
    :param data: The data received
    :param mqttClient: Client that received the data
    """
    posData = tricc.PositionData()
    posData.ParseFromString(data)
    if (mqttClient.serverInterface != None):
        serverInterfaceMethod(mqttClient.serverInterface, posData)
    print "Received position zero data"
Exemple #3
0
 def sendPositionDataRelay(self, longitude, latitude):
     """
     Send gps data for a relay node
     :param longitude: Longitude of gps stamp (float)
     :param latitude:  Latitude of gps stamp (float)
     """
     positionData = tricc.PositionData()
     positionData.header.CopyFrom(self.__createHeader("PositionRelay"))
     positionData.longitude = longitude
     positionData.latitude = latitude
     self.mqtt.publish(positionData.header.topic,
                       bytearray(positionData.SerializeToString()))