# This script simply starts the sensor-thread & gives out the sensor-data in a desired mode.

from debug_log import debug_print
lg = debug_print()
import sensors
import time

mod = int(raw_input("Modus? 0, 1 oder 2? "))

sens = sensors.sensors(mode=mod, start=False)

raw_input("Press enter to start")
sens.start()

time.sleep(1)

while True:
	out = str(sens.running) + ": " + str(sens.measurements[0][0]) + ", ("
	for entry in sens.measurements[1]:
		out = out + str(entry[0]) + ", "
	out = out + "), "  + str(sens.measurements[2][0])
	f=open("test.txt", "w")
	print out + "\n"
	f.write(out + "\n")
	f.close()
	time.sleep(.5)
Exemplo n.º 2
0
import debug_log
lg = debug_log.debug_print()
import gpsdData
import time

gpsp = gpsdData.GpsPoller()

try:
	while True:
		print gpsp.data[3]
		time.sleep(0.1)
except:
	gpsp.running = False
Exemplo n.º 3
0
from debug_log import debug_print

lg = debug_print()
from sensors import GPSCarSensors
import time

mod = int(raw_input("Modus? 0, 1 oder 2? "))

sens = GPSCarSensors(mode=mod, start=False)

raw_input("Press enter to start")
sens.start()

time.sleep(1)

while True:
    out = "%s: %s, %s, %s\n" % (str(sens.running), sens.measurements[0][0],
                                sens.measurements[1], sens.measurements[2][0])
    # f = open("test.txt", "w")
    print out
    # f.write(out)
    # f.close()
    time.sleep(.1)
Exemplo n.º 4
0
# This script continously saves GPS-data to a file in the format 'lat,long' for debbuging-issues
# for example one afterwards can calculate the average & standard-deviation via calc_dev.py

import time
import debug_log
lg = debug_log.debug_print()
import gpsdData
gps = gpsdData.GpsPoller()

fn=" "

while fn != 'no':
	print "save gps data as list"
	fn = raw_input("filename? e.g. GPS_DATA1.txt")
	print

	filex = open(fn, "w")

	for i in range(240):
		print str(i) + ": "+ str(gps.data[0:2])
		filex.write(str(gps.data[0])+","+str(gps.data[1])+"\n")
		time.sleep(0.5)
	
	filex.close()

	fn = raw_input("next filename? no for quit ")

gps.running = False
Exemplo n.º 5
0
#	time year month day hour minute second latitude longitude altitude track [satellites] GPS_time steering_direction steering_velocity steering_position
#	(seperated by the data-separator, which bei default is tab \t and can be adjusted by mylog.data_separator = new_separator)
#	[satallites] hereby is a list
# each call of add_log will generate one line in the file
#
# NOTE: track = heading = degree between north and direction (clockwise)
#	fix_time = GPS_time = time, when GPS position was aquired (in seconds since 1970 or somewhat... form time.time()) <-- not sure about that

import time  # maybe needs to be in add_log??

# initialize log
from debug_log import debug_print

lg = debug_print(debug_level=150,
                 save_level=0,
                 save_debug=True,
                 filename="debug_print/debugprint" + str(time.time()) + ".txt",
                 time_stamp=False)


class gpslog:
    # initialize: open file, set to open, set separator
    def __init__(self, log_file_name):
        self.log_file = open(log_file_name, 'a')
        self.opened = True
        self.data_separator = "\t"

    # write log-data in specific format
    def add_log(self, current_status, GPS_data):
        if (self.opened == False):
            lg.prt(
Exemplo n.º 6
0
#
# use the following for output:
# from __main__ import lg 	(not in this file)
# lg.prt( --messages & objects--, lv = --LEVEL--, inst=__name__)
# SUGGESTED LEVELS:
#
#	10	useless, any
#	100	info
#	1000	debug
#	10000	warning
#	100000	error
#
# possible Parameters: debug_level=0, save_debug=False, filename="", save_level="", time_stamp=False

from debug_log import debug_print # must be imported as first module directly after time!
lg = debug_print(debug_level=150, save_level=0, save_debug=True, filename="debug_print/debugprint"+str(time.time())+".txt", time_stamp=False) # create output-control-instance

import GPS_log			# to log the GPS-data in some file 'log/RC_log'+str(time.time())+'.txt'
import sensors			# to let the sensors work in the background
from navigation import * 	# to calculate best direction
from drive import *		# to be able to steet motor and wheels, and init Fahrtregler
import math			# for checking whether GPS is a number
import gpsdData as GPS		# to get GPS-data and compass-value

#----------------------------------------------------------------------------------------#

# definitions

obstacle = 50 		# trigger-distance (in cm) for left & right sensor (0 & 2) to break, if there is an obstacle too close
free_path = 200		# distance (in cm) for the navigation-algorithm to set the path as occupied/blocked
sens_min = 7 		# minimal possible distance (in cm) for sensors (closer objects: ignore result of sensor)