Beispiel #1
0
    def __init__(self, config, robotProto):
        self.parent = baseCellBot.CellBot(config, robotProto)
        self.config = config
        self.robotProto = robotProto

        # wheel speeds of the two different wheels, in tuple (left, right)
        self.wheelSpeeds = SensorReading('wheelSpeeds')
Beispiel #2
0
 def __init__(self, config, robotProto):
     # reference to the global configuration object
     self.config = config
     self.robotProto = robotProto
     # current heading on robot in degrees
     self.heading = SensorReading('heading')
     # speed
     self.speed = SensorReading('speed')
     # last queried location by tuple (latitude, longitude)
     self.location = SensorReading('location')
     # available sensor types
     #    self.sensorTypes = {}
     # adds SensorType objects.
     #    self.addSensorTypes()
     # previous spoken messages
     self.previousMsg = ''
     droid.startSensing()
     droid.startLocating()
     self.robotProto.StartSensorStream()
Beispiel #3
0
 def addReading(self, reading, timeseries=False):
     if not timeseries:
         del self.readings[:]
     self.readings.append(SensorReading(reading))
Beispiel #4
0
from enum import Enum
import json
from sensorReading import SensorReading


class BaseUnitLa(Enum):
    FARENHEIT = 'FARENHEIT'
    CELCIUS = 'CELCIUS'


sr = SensorReading("foo", 1, SensorReading.BaseUnit.CELCIUS)
sr1 = SensorReading("foo", 1, None)

s = sr.to_json()
print(s)

js = '{"baseUnit": "CELCIUS","sensorId": "foo","temperature": 1}'
sr2 = SensorReading.from_json(js)
print(sr2.baseUnit)