<commit_before>#include <string>

#include <ros/ros.h>
#include <geometry_msgs/Twist.h>

#include "../include/hmmwv/gpio.hpp"
#include "../include/hmmwv/engine.hpp"

using namespace ros;
using namespace std;

GPIO gpio;
						// enable	direction		speed
Engine driveLeft(&gpio, GPIO::P8_10, GPIO::P8_12, GPIO::P8_13);
Engine driveRight(&gpio, GPIO::P9_23, GPIO::P9_21, GPIO::P9_14);
//Engine rotatorLeft(..);
//Engine rotatorRight(..);

void velocityCallback(const geometry_msgs::Twist& msg) {
	ROS_INFO("%f", msg.linear.x);

	if (msg.linear.x > .1) {
		// drive forward
		driveLeft.start(-1, msg.linear.x);
		driveRight.start(1, msg.linear.x);
	}
	else if (msg.linear.x < -.1) {
		// drive backward
		driveLeft.start(1, msg.linear.x);
		driveRight.start(-1, msg.linear.x);
	}
	else {
		// stop
		driveLeft.start(0);
		driveRight.start(0);
	}
}

int main(int argc, char **argv) {
	driveLeft.start(0);
	driveRight.start(0);

	// init ros
	init(argc, argv, "enginecontrol");
	NodeHandle n;<commit_msg>EngineControl: invert motor directions, different debug output<commit_after>#include <string>

#include <ros/ros.h>
#include <geometry_msgs/Twist.h>

#include "../include/hmmwv/gpio.hpp"
#include "../include/hmmwv/engine.hpp"

using namespace ros;
using namespace std;

GPIO gpio;
						// enable	direction		speed
Engine driveLeft(&gpio, GPIO::P8_10, GPIO::P8_12, GPIO::P8_13);
Engine driveRight(&gpio, GPIO::P9_23, GPIO::P9_21, GPIO::P9_14);
//Engine rotatorLeft(..);
//Engine rotatorRight(..);

void velocityCallback(const geometry_msgs::Twist& msg) {
	//ROS_INFO("%f", msg.linear.x);

	if (msg.linear.x > .1) {
		// drive forward
		ROS_INFO("Forward");
		driveLeft.start(1, msg.linear.x);
		driveRight.start(-1, msg.linear.x);
	}
	else if (msg.linear.x < -.1) {
		ROS_INFO("Backward");
		// drive backward
		driveLeft.start(-1, msg.linear.x * -1.0); // The speed value must be in range [0, 1]
		driveRight.start(1, msg.linear.x * -1.0);
	}
	else {
		// stop
		driveLeft.start(0);
		driveRight.start(0);
	}
}

int main(int argc, char **argv) {
	driveLeft.start(0);
	driveRight.start(0);

	// init ros
	init(argc, argv, "enginecontrol");
	NodeHandle n;
{'fraction_non_alphanumeric': 0.18084611808461182, 'fraction_numerical': 0.02882380288238029, 'mean_word_length': 3.9699769053117784, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '519535', 'n_tokens_mistral': 891, 'n_tokens_neox': 833, 'n_words': 174}