Set sonar angle to 5° degree
[ros_wild_thumper.git] / scripts / sensor_board.py
index 337830d..e431b57 100755 (executable)
@@ -11,8 +11,8 @@ from pyshared.humidity import *
 from wild_thumper.msg import Sensor
 
 # Board warming offset
-TEMP_ERROR = -2 # -5 # degree celsius
-PRESSURE_ERROR = -4.5
+TEMP_ERROR = 0 # -5 # degree celsius
+PRESSURE_ERROR = -2.5
 
 """
 LDR:
@@ -43,9 +43,13 @@ def get(addr=0x58):
        pressure_kpa = P = (pressure_v/5 + 0.04) / 0.004 + PRESSURE_ERROR # datasheet
 
        # fix temperature/humidity
-       temp_real = temp_mess + TEMP_ERROR 
-       humidity_abs = calc_humidity_abs(temp_mess, humidity_mess)
-       humidity_real = calc_humidity_rel(temp_real, humidity_abs)
+       if TEMP_ERROR:
+               temp_real = temp_mess + TEMP_ERROR
+               humidity_abs = calc_humidity_abs(temp_mess, humidity_mess)
+               humidity_real = calc_humidity_rel(temp_real, humidity_abs)
+       else:
+               temp_real = temp_mess
+               humidity_real = humidity_mess
 
        return lux, temp_real, humidity_real, pressure_kpa, co
 
@@ -66,8 +70,6 @@ class SensorBoard:
                                if (datetime.now() - t_last_check).seconds > 900:
                                        ventilate = check_ventilate(temp, humidity)
                                        t_last_check = datetime.now()
-                               if (ventilate > 1.10):
-                                       print "Lüften!"
                                
                                msg = Sensor()
                                msg.header.stamp = rospy.Time.now()
@@ -76,7 +78,7 @@ class SensorBoard:
                                msg.humidity = humidity
                                msg.pressure = pressure
                                msg.co = co
-                               msg.ventilate = ventilate
+                               msg.ventilate = True if ventilate > 1.10 else False
 
                                self.pub.publish(msg)