<commit_before>#include "twoDInfraredSensor.h"

#include <commonTwoDModel/engine/twoDModelEngineInterface.h>

using namespace trikKitInterpreter::robotModel::twoD::parts;

TwoDInfraredSensor::TwoDInfraredSensor(interpreterBase::robotModel::DeviceInfo const &info
		, interpreterBase::robotModel::PortInfo const &port
		, twoDModel::engine::TwoDModelEngineInterface &engine)
	: twoDModel::robotModel::parts::RangeSensor(info, port, engine)
{
}

void TwoDInfraredSensor::read()
{
	int const distanceValue = mEngine.readSonarSensor(port());
	/// @todo: Know how real IR sensor works and model something similar to it.
	emit newData(255 - distanceValue);
}
<commit_msg>An attempt to make IR sensor`s behaviour more close to reality<commit_after>#include "twoDInfraredSensor.h"

#include <commonTwoDModel/engine/twoDModelEngineInterface.h>

using namespace trikKitInterpreter::robotModel::twoD::parts;

TwoDInfraredSensor::TwoDInfraredSensor(interpreterBase::robotModel::DeviceInfo const &info
		, interpreterBase::robotModel::PortInfo const &port
		, twoDModel::engine::TwoDModelEngineInterface &engine)
	: twoDModel::robotModel::parts::RangeSensor(info, port, engine)
{
}

void TwoDInfraredSensor::read()
{
	int const sonarDistanceValue = mEngine.readSonarSensor(port());
	int const linearDistance = 100 - sonarDistanceValue * 100 / 255;
	/// @todo: Know how real IR sensor works and model something similar to it.
	emit newData(linearDistance);
}

{'fraction_non_alphanumeric': 0.11003460207612457, 'fraction_numerical': 0.008304498269896194, 'mean_word_length': 7.710843373493976, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5456784', 'n_tokens_mistral': 472, 'n_tokens_neox': 468, 'n_words': 96}