import logging; logger = logging.getLogger("morse." + __name__)
import pymoos.MOOSCommClient
from morse.middleware.moos import AbstractMOOS
from morse.core import blenderapi

class PressureNotifier(AbstractMOOS):
    def default(self,  ci='unused'):
        precision = 0.2
        cur_time=pymoos.MOOSCommClient.MOOSTime()
        # post the simulation time so that it can be synced to MOOSTime
        self.m.Notify('actual_time', blenderapi.persistantstorage().current_time, cur_time)
        S = "binf="+str(self.data['pressure']-precision)+",bsup="+str(self.data['pressure']+precision)
        #logger.info("robot at %sm deep" % (self.data['pressure']))
        self.m.Notify("PRESSURE_Z", S, cur_time)