<commit_before>#include <gameplay/GameplayModule.hpp>

#include <poll.h>
#include <QMutexLocker>

#include <protobuf/RadioRx.pb.h>
#include <protobuf/RadioTx.pb.h>
#include <protobuf/messages_robocup_ssl_detection.pb.h>
#include <protobuf/messages_robocup_ssl_geometry.pb.h>
#include <protobuf/messages_robocup_ssl_wrapper.pb.h>
#include <Constants.hpp>
#include <Geometry2d/Util.hpp>
#include <LogUtils.hpp>
#include <Robot.hpp>
#include <RobotConfig.hpp>
#include <Utils.hpp>
#include <joystick/GamepadController.hpp>
#include <joystick/GamepadJoystick.hpp>
#include <joystick/Joystick.hpp>
#include <joystick/SpaceNavJoystick.hpp>
#include <motion/MotionControl.hpp>
#include <multicast.hpp>
#include <planning/IndependentMultiRobotPathPlanner.hpp>
#include <rc-fshare/git_version.hpp>
#include "Processor.hpp"
#include "modeling/BallTracker.hpp"
#include "radio/SimRadio.hpp"
#include "radio/USBRadio.hpp"

REGISTER_CONFIGURABLE(Processor)

using namespace std;
using namespace boost;
using namespace Geometry2d;
using namespace google::protobuf;

static const auto Command_Latency = 0ms;

RobotConfig* Processor::robotConfig2008;
RobotConfig* Processor::robotConfig2011;
RobotConfig* Processor::robotConfig2015;
std::vector<RobotStatus*>
    Processor::robotStatuses;  ///< FIXME: verify that this is correct

Field_Dimensions* currentDimensions = &Field_Dimensions::Current_Dimensions;

void Processor::createConfiguration(Configuration* cfg) {
    robotConfig2008 = new RobotConfig(cfg, "Rev2008");
    robotConfig2011 = new RobotConfig(cfg, "Rev2011");
    robotConfig2015 = new RobotConfig(cfg, "Rev2015");

    for (size_t s = 0; s < Num_Shells; ++s) {
        robotStatuses.push_back(
            new RobotStatus(cfg, QString("Robot Statuses/Robot %1").arg(s)));
    }
}

Processor::Processor(bool sim, bool defendPlus, VisionChannel visionChannel,
                     bool blueTeam, std::string readLogFile="")
    : _loopMutex(), _blueTeam(blueTeam), _readLogFile(readLogFile) {
    _running = true;
    _manualID = -1;
    _framerate = 0;
    _useOurHalf = true;
    _useOpponentHalf = true;
    _initialized = false;
    _simulation = sim;
    _radio = nullptr;

    _multipleManual = false;
    setupJoysticks();

    _dampedTranslation = true;
    _dampedRotation = true;

    _kickOnBreakBeam = false;

    // Initialize team-space transformation
    defendPlusX(defendPlus);

    QMetaObject::connectSlotsByName(this);

    _ballTracker = std::make_shared<BallTracker>();
    _refereeModule = std::make_shared<NewRefereeModule>(_state);
    _refereeModule->start();
    _gameplayModule = std::make_shared<Gameplay::GameplayModule>(&_state);
    _pathPlanner = std::unique_ptr<Planning::MultiRobotPathPlanner>(
        new Planning::IndependentMultiRobotPathPlanner());
    vision.simulation = _simulation;
    if (sim) {
        vision.port = SimVisionPort;
    }
    vision.start();

    _visionChannel = visionChannel;

    // Create radio socket
    _radio = _simulation ? static_cast<Radio*>(new SimRadio(_state, _blueTeam))
                         : static_cast<Radio*>(new USBRadio());

    if (!readLogFile.empty()) {
        _logger.readFrames("/home/jay/20180626-192851.log");
        firstLogTime = _logger.startTime();
    }<commit_msg>Fix typo in readFrames<commit_after>#include <gameplay/GameplayModule.hpp>

#include <poll.h>
#include <QMutexLocker>

#include <protobuf/RadioRx.pb.h>
#include <protobuf/RadioTx.pb.h>
#include <protobuf/messages_robocup_ssl_detection.pb.h>
#include <protobuf/messages_robocup_ssl_geometry.pb.h>
#include <protobuf/messages_robocup_ssl_wrapper.pb.h>
#include <Constants.hpp>
#include <Geometry2d/Util.hpp>
#include <LogUtils.hpp>
#include <Robot.hpp>
#include <RobotConfig.hpp>
#include <Utils.hpp>
#include <joystick/GamepadController.hpp>
#include <joystick/GamepadJoystick.hpp>
#include <joystick/Joystick.hpp>
#include <joystick/SpaceNavJoystick.hpp>
#include <motion/MotionControl.hpp>
#include <multicast.hpp>
#include <planning/IndependentMultiRobotPathPlanner.hpp>
#include <rc-fshare/git_version.hpp>
#include "Processor.hpp"
#include "modeling/BallTracker.hpp"
#include "radio/SimRadio.hpp"
#include "radio/USBRadio.hpp"

REGISTER_CONFIGURABLE(Processor)

using namespace std;
using namespace boost;
using namespace Geometry2d;
using namespace google::protobuf;

static const auto Command_Latency = 0ms;

RobotConfig* Processor::robotConfig2008;
RobotConfig* Processor::robotConfig2011;
RobotConfig* Processor::robotConfig2015;
std::vector<RobotStatus*>
    Processor::robotStatuses;  ///< FIXME: verify that this is correct

Field_Dimensions* currentDimensions = &Field_Dimensions::Current_Dimensions;

void Processor::createConfiguration(Configuration* cfg) {
    robotConfig2008 = new RobotConfig(cfg, "Rev2008");
    robotConfig2011 = new RobotConfig(cfg, "Rev2011");
    robotConfig2015 = new RobotConfig(cfg, "Rev2015");

    for (size_t s = 0; s < Num_Shells; ++s) {
        robotStatuses.push_back(
            new RobotStatus(cfg, QString("Robot Statuses/Robot %1").arg(s)));
    }
}

Processor::Processor(bool sim, bool defendPlus, VisionChannel visionChannel,
                     bool blueTeam, std::string readLogFile="")
    : _loopMutex(), _blueTeam(blueTeam), _readLogFile(readLogFile) {
    _running = true;
    _manualID = -1;
    _framerate = 0;
    _useOurHalf = true;
    _useOpponentHalf = true;
    _initialized = false;
    _simulation = sim;
    _radio = nullptr;

    _multipleManual = false;
    setupJoysticks();

    _dampedTranslation = true;
    _dampedRotation = true;

    _kickOnBreakBeam = false;

    // Initialize team-space transformation
    defendPlusX(defendPlus);

    QMetaObject::connectSlotsByName(this);

    _ballTracker = std::make_shared<BallTracker>();
    _refereeModule = std::make_shared<NewRefereeModule>(_state);
    _refereeModule->start();
    _gameplayModule = std::make_shared<Gameplay::GameplayModule>(&_state);
    _pathPlanner = std::unique_ptr<Planning::MultiRobotPathPlanner>(
        new Planning::IndependentMultiRobotPathPlanner());
    vision.simulation = _simulation;
    if (sim) {
        vision.port = SimVisionPort;
    }
    vision.start();

    _visionChannel = visionChannel;

    // Create radio socket
    _radio = _simulation ? static_cast<Radio*>(new SimRadio(_state, _blueTeam))
                         : static_cast<Radio*>(new USBRadio());

    if (!readLogFile.empty()) {
        _logger.readFrames(readLogFile.c_str());
        firstLogTime = _logger.startTime();
    }
{'fraction_non_alphanumeric': 0.11969998469309659, 'fraction_numerical': 0.015306903413439462, 'mean_word_length': 4.701570680628272, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 63, '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': '6919256', 'n_tokens_mistral': 2218, 'n_tokens_neox': 2110, 'n_words': 389}