def __init__(self): rospy.init_node("mongo_bridge") have_dc = dc_util.wait_for_mongo() if not have_dc: raise Exception("No Datacentre?") self._mongo_client=pymongo.MongoClient(rospy.get_param("datacentre_host"), rospy.get_param("datacentre_port") ) # advertise ros services for attr in dir(self): if attr.endswith("_ros_srv"): service=getattr(self, attr) rospy.Service("/mongo_bridge/"+attr[:-8], service.type, service)
def __init__(self, name="autonomous_patroller"): self._active_episode = False got_datacentre = dc_util.wait_for_mongo() if not got_datacentre: raise Exception("strands_datacentres does not appear to be running") self._mongo = pymongo.MongoClient(rospy.get_param("datacentre_host", "localhost"), int(rospy.get_param("datacentre_port"))) self._db = self._mongo[name].episodes self._mileage_sub = rospy.Subscriber('/mileage', Float32, self._mileage_cb) self._odom_mileage_sub = rospy.Subscriber('/odom_mileage', Float32, self._odom_mileage_cb) self._batterystate_sub = rospy.Subscriber('/battery_state', BatteryState, self._batterystate_cb) self._mileage = 0 self._odom_mileage = 0 self._battery = 100
def __init__(self, name="autonomous_patroller"): self._active_episode = False got_datacentre = dc_util.wait_for_mongo() if not got_datacentre: raise Exception( "strands_datacentres does not appear to be running") self._mongo = pymongo.MongoClient( rospy.get_param("datacentre_host", "localhost"), int(rospy.get_param("datacentre_port"))) self._db = self._mongo[name].episodes self._mileage_sub = rospy.Subscriber('/odom_mileage', Float32, self._mileage_cb) self._odom_mileage_sub = rospy.Subscriber('/odom_mileage', Float32, self._odom_mileage_cb) self._batterystate_sub = rospy.Subscriber('/battery_state', BatteryState, self._batterystate_cb) self._mileage = 0 self._odom_mileage = 0 self._battery = 100