def __init__(self):
        self.sensor = ms5837.MS5837_02BA(
        )  # Default I2C bus is 1 (Raspberry Pi 3)
        self.client = Client(DEPTH_DRIVER_PORT)

        self.logger = DEFLOG.DEPTH_LOCAL_LOG
        if self.logger:
            self.logger = Logger(filename='depth_sensor',
                                 directory=DEFLOG.LOG_DIRECTORY)
Example #2
0
#!/usr/bin/env python

import ms5837

sensor = ms5837.MS5837_02BA(1)

if not sensor.init():
    print("sensor gabisa")
    exit(1)

while True:
    if sensor.read():
        print("P: %0.1f") % (sensor.pressure())
    else:
        print("SENSOR GAKEBACA")
#!/usr/bin/python
import ms5837
import time

sensor = ms5837.MS5837_02BA()  # Default I2C bus is 1 (Raspberry Pi 3)

if not sensor.init():
    print("Sensor could not be initialized")
    exit(1)

# Spew readings
while True:
    if sensor.read():
        print("P: %0.1f mbar  %0.3f psi\tT: %0.2f C  %0.2f F") % (
            sensor.pressure(),  # Default is mbar (no arguments)
            sensor.pressure(ms5837.UNITS_psi),  # Request psi
            sensor.temperature(),  # Default is degrees C (no arguments)
            sensor.temperature(ms5837.UNITS_Farenheit))  # Request Farenheit
    else:
        print("Sensor read failed!")
        exit(1)
Example #4
0
from time import sleep
import serial
import threading
import pygame


def portIsUsable():
    try:
        ser = serial.Serial("/dev/ttyACM0", 9600)
        return ser
    except:
        return False


sensor1 = tsys01.TSYS01()
sensor2 = ms5837.MS5837_02BA(0)

if not sensor2.init():
    print("sensor cant be initialized")
    exit(1)

if not sensor2.read():
    print("sensor read failed")
    exit(1)

if not sensor1.init():
    print("Error Initialiazing Sensor")
    exit(1)

if pygame.joystick.get_count() == 0:
    print("connect joystick")
Example #5
0
#! /usr/bin/env python3

import tsys01
import ms5837
from time import sleep
from std_msgs.msg import Float32

from brping import Ping1D
import rospy
from sensor_msgs.msg import FluidPressure, Temperature

sensor3 = Ping1D("/dev/ttyUSB0", 115200)

sensor_data = tsys01.TSYS01()
pressure_data = ms5837.MS5837_02BA(0)

if not sensor_data.init():
    print("Error initializing sensor")
    rospy.logfatal('failed to initialise MS5873 ! Is the sensor connected ?')
    exit(1)
if not pressure_data.init():
    print("Sensor could not be initialized")
    exit(1)

instant_temperature = rospy.Publisher('Instant/Temperature',
                                      Temperature,
                                      queue_size=1)
pub1 = rospy.Publisher('Altimeter', Float32, queue_size=1)
pub_pressure = rospy.Publisher('sensors/Pressure',
                               FluidPressure,
                               queue_size=20)