<commit_before>#include "switchSensor.h"
#include <string>

using namespace std;

SwitchSensor::SwitchSensor(){
	tag = "undefined";
	state = 0;
}

SwitchSensor::SwitchSensor(string s){
	tag = s;
	state = 0;
}

//For extensibility issues
int SwitchSensor::read(){
	return getState();
}

bool SwitchSensor::setState(int s){
	state = s;
}

//Read raw information and translate it to a single int.
int SwitchSensor::readParse() {
	//TODO: Find sensor to read from...
	return 0;
}

int SwitchSensor::getState(){
	//state = readParse();
	return state;
}

string SwitchSensor::getTag(){
	return tag;
}
//ahahaha deze code. Volgens mij gaat nu geen een van de bovenstaande functies werken. 
//Dit moet nog naar de SwitchSensor namespace verplaatst worden
int main(int argc, char **argv) {
	std::fstream fs;
	fs.open("/sys/class/gpio/export");
	fs << 60;  							// <<< PORT
	fs.close();

	fs.open("/sys/class/gpio/gpio60/direction"); //PORT 
	fs << "in";
	fs.close();

	ros::init(argc, argv, "switchSensor");
	ros::NodeHandle handle;
	ros::Publisher pub = handle.advertise<std_msgs::Int16>("/tawi/sensors/switch", 100);
	std_msgs::Int16 msg;
	ros::Rate loop_Rate(5);

	while(ros::ok()){
		int stateRead = 2; 
		fs.open("/sys/class/gpio/gpio60/value");   // <<< PORT
		fs >> stateRead;
		fs.close();
		if(stateRead == 2)
			ROS_INFO("stateRead not set");
		msg.data = 1-stateRead; //Inverting for BBB logic
		
		pub.publish(msg);
		ROS_INFO("Switch broadcasts %d", msg.data);
		loop_Rate.sleep();
	}
}<commit_msg>Fixed port numbers on sensors and drivers.<commit_after>#include "switchSensor.h"
#include <string>

using namespace std;

SwitchSensor::SwitchSensor(){
	tag = "undefined";
	state = 0;
}

SwitchSensor::SwitchSensor(string s){
	tag = s;
	state = 0;
}

//For extensibility issues
int SwitchSensor::read(){
	return getState();
}

bool SwitchSensor::setState(int s){
	state = s;
}

//Read raw information and translate it to a single int.
int SwitchSensor::readParse() {
	//TODO: Find sensor to read from...
	return 0;
}

int SwitchSensor::getState(){
	//state = readParse();
	return state;
}

string SwitchSensor::getTag(){
	return tag;
}
//ahahaha deze code. Volgens mij gaat nu geen een van de bovenstaande functies werken. 
//Dit moet nog naar de SwitchSensor namespace verplaatst worden
int main(int argc, char **argv) {
	std::fstream fs;
	fs.open("/sys/class/gpio/export");
	fs << 7;  							// <<< PORT
	fs.close();

	fs.open("/sys/class/gpio/gpio7/direction"); //PORT 
	fs << "in";
	fs.close();

	ros::init(argc, argv, "switchSensor");
	ros::NodeHandle handle;
	ros::Publisher pub = handle.advertise<std_msgs::Int16>("/tawi/sensors/switch", 100);
	std_msgs::Int16 msg;
	ros::Rate loop_Rate(5);

	while(ros::ok()){
		int stateRead = 2; 
		fs.open("/sys/class/gpio/gpio7/value");   // <<< PORT
		fs >> stateRead;
		fs.close();
		if(stateRead == 2)
			ROS_INFO("stateRead not set");
		msg.data = 1-stateRead; //Inverting for BBB logic
		
		pub.publish(msg);
		ROS_INFO("Switch broadcasts %d", msg.data);
		loop_Rate.sleep();
	}
}
{'fraction_non_alphanumeric': 0.16446934739617666, 'fraction_numerical': 0.012195121951219513, 'mean_word_length': 4.075250836120401, 'pattern_counts': {'":': 0, '<': 27, '<?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': '929591', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1097, 'n_words': 284}