<commit_before>#invenvi core file

import logging
import os

from model_data import ModelData

class invenaviKernel:
    def __init__(self, config, debug=False):
        self.config = config
        self.debug = debug

        # sensors
        self._gps_sensor = config.gps_sensor
        #self._compass_sensor = config.compass_sensor
        #self._temperature_sensor = config.temperature_sensor

        # vehicle
        self._drive_controller = config.drive_controller

        # data class
        self.data = ModelData()

    def set_throttle(self, throttle_level):
        self._drive_controller.set_throttle(throttle_level)

    def set_steering(self, angle):
        self._drive_controller.set_steering(angle)

    def read_GPS(self):
        if self._gps_sensor:
            (fix, lat, lon, heading, speed, altitude, num_sat, timestamp, datestamp) = self._gps_sensor.read_sensor()
            self.data.fix = fix
            self.data.lat = lat
            self.data.lon = lon
            self.data.gps_heading = heading
            self.data.speed = speed
            self.data.altitude = altitude
            self.data.num_sat = num_sat
            self.data.timestamp = timestamp
            self.data.datestamp = datestamp
            self.data.has_GPS = True
        else:
            self.data.has_GPS = False

    def update(self):
        try:
            self.read_GPS()
        except Exception as ex:
            self.data.has_GPS = False
            logging.exception("CORE:\tError in update loop (GPS) - %s" % ex)
    def halt(self):
        pass<commit_msg>migrate to python-gps()<commit_after>#invenvi core file

import logging
import os

from model_data import ModelData

class invenaviKernel:
    def __init__(self, config, debug=False):
        self.config = config
        self.debug = debug

        # sensors
        self._gps_sensor = config.gps_sensor
        #self._compass_sensor = config.compass_sensor
        #self._temperature_sensor = config.temperature_sensor

        # vehicle
        self._drive_controller = config.drive_controller

        # data class
        self.data = ModelData()

    def set_throttle(self, throttle_level):
        self._drive_controller.set_throttle(throttle_level)

    def set_steering(self, angle):
        self._drive_controller.set_steering(angle)

    def read_GPS(self):
        if self._gps_sensor:
            self._gps_sensor.next()
            self.data.lat = self._gps_sensor.fix.latitude
            self.data.lon = self._gps_sensor.fix.longitude
            self.data.altitude = self._gps_sensor.fix.fix.altitude
            self.data.has_GPS = True
        else:
            self.data.has_GPS = False

    def update(self):
        try:
            self.read_GPS()
        except Exception as ex:
            self.data.has_GPS = False
            logging.exception("CORE:\tError in update loop (GPS) - %s" % ex)
    def halt(self):
        pass

{'fraction_non_alphanumeric': 0.08461276015011941, 'fraction_numerical': 0.0, 'mean_word_length': 2.109225874867444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6452419', 'n_tokens_mistral': 885, 'n_tokens_neox': 861, 'n_words': 180}