<commit_before>#include "controller.h"
#include <common/utils/GPSUtils.h>


Controller::Controller(GPSWaypointSource *source, GPS *gps) : _gps(gps)
{
    _source = source;
    currentWaypoint = _source->getNext();
    if(_gps != nullptr)
        connect(_gps, SIGNAL(onNewData(GPSData)), this, SLOT(onNewGPS(GPSData)));
}

Controller::~Controller()
{
    if(_gps != nullptr)
        disconnect(_gps, SIGNAL(onNewData(GPSData)), this, SLOT(onNewGPS(GPSData)));
}

void Controller::onNewGPS(GPSData data)
{
    std::cout << "In"<<std::endl;
    if(GPSUtils::coordsToMeter(currentWaypoint.Lat(), currentWaypoint.Long(), data.Lat(), data.Long()) < 1.0) //need to be within 1 meter radius of the waypoint
    {
        std::cout << "here" <<std::endl;
        currentWaypoint = _source->getNext();
        onNewWaypoint(currentWaypoint);
    }
}

GPSData Controller::getCurrentWaypoint()
{
    return currentWaypoint;
}<commit_msg>Cleans up some comments / printouts.<commit_after>#include "controller.h"
#include <common/utils/GPSUtils.h>


Controller::Controller(GPSWaypointSource *source, GPS *gps) : _gps(gps)
{
    _source = source;
    currentWaypoint = _source->getNext();
    if(_gps != nullptr)
        connect(_gps, SIGNAL(onNewData(GPSData)), this, SLOT(onNewGPS(GPSData)));
}

Controller::~Controller()
{
    if(_gps != nullptr)
        disconnect(_gps, SIGNAL(onNewData(GPSData)), this, SLOT(onNewGPS(GPSData)));
}

void Controller::onNewGPS(GPSData data)
{
    // need to be within 1 meter radius of the waypoint (see rules)
    if(GPSUtils::coordsToMeter(currentWaypoint.Lat(), currentWaypoint.Long(), data.Lat(), data.Long()) < 1.0)
    {
        currentWaypoint = _source->getNext();
        onNewWaypoint(currentWaypoint);
    }
}

GPSData Controller::getCurrentWaypoint()
{
    return currentWaypoint;
}
{'fraction_non_alphanumeric': 0.1518987341772152, 'fraction_numerical': 0.003302146395156852, 'mean_word_length': 4.475903614457831, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, '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': '3509070', 'n_tokens_mistral': 656, 'n_tokens_neox': 630, 'n_words': 113}