mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-04 12:24:57 +00:00
Reorganisation
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -5,3 +5,8 @@ src/C++/progr
|
|||||||
src/C++/Driver/odometry.txt
|
src/C++/Driver/odometry.txt
|
||||||
src/C++/Driver/CMakeCache.txt
|
src/C++/Driver/CMakeCache.txt
|
||||||
src/C++/Driver/kobuki_control
|
src/C++/Driver/kobuki_control
|
||||||
|
src/C++/Driver/cmake_install.cmake
|
||||||
|
src/C++/Driver/vgcore.42436
|
||||||
|
src/C++/Driver/vgcore.42611
|
||||||
|
src/Socket/a.out
|
||||||
|
src/C++/Driver/cmake_install.cmake
|
||||||
|
@@ -12,7 +12,7 @@ if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
|||||||
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
||||||
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_INSTALL_CONFIG_NAME "")
|
set(CMAKE_INSTALL_CONFIG_NAME "DEBUG")
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
||||||
endif()
|
endif()
|
||||||
|
BIN
src/C++/Socket/a.out
Executable file
BIN
src/C++/Socket/a.out
Executable file
Binary file not shown.
@@ -1,60 +0,0 @@
|
|||||||
//before running set right baudrate
|
|
||||||
//sudo stty -F /dev/ttyUSB0 speed 115200 cs8 -cstopb -parenb
|
|
||||||
//TODO: Fix the first output of the buffer
|
|
||||||
#include <fstream>
|
|
||||||
#include <iostream>
|
|
||||||
#include <cstring>
|
|
||||||
#include <vector>
|
|
||||||
#include <iomanip>
|
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
char byte;
|
|
||||||
bool foundAA = false;
|
|
||||||
std::vector<char> buffer;
|
|
||||||
std::ifstream f("/dev/ttyUSB0", std::ios::binary);
|
|
||||||
if (!f.is_open()) {
|
|
||||||
std::cerr << "Failed to open the file" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (f.read(&byte, 1)) {
|
|
||||||
unsigned char ubyte = static_cast<unsigned char>(byte);
|
|
||||||
buffer.push_back(ubyte);
|
|
||||||
if (foundAA) {
|
|
||||||
if (ubyte == 0b01010101) { // 0x55
|
|
||||||
std::cout << "Found 0xAA followed by 0x55" << std::endl;
|
|
||||||
// std::cout << "Buffer size" << buffer.size() << std::endl << std::endl;
|
|
||||||
// Print the buffer in hex values
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
std::cout << "0x" << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(static_cast<unsigned char>(buffer[i])) << " ";
|
|
||||||
}
|
|
||||||
//reset buffer after new 0XAA and 0x55 is found
|
|
||||||
buffer.clear();
|
|
||||||
foundAA = false; // Reset the state
|
|
||||||
if (ubyte == 0b10101010)
|
|
||||||
foundAA = true;
|
|
||||||
} else {
|
|
||||||
foundAA = false; // Reset the state if the next byte is not 0x55
|
|
||||||
}
|
|
||||||
} else if (ubyte == 0b10101010) { // 0xAA
|
|
||||||
foundAA = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
f.close();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Tomorrow
|
|
||||||
//Try to use vectors and store every byte in its own array object by dividing the buffer into 8 bits
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Tomorrow
|
|
||||||
//Try to use vectors and store every byte in its own array object by dividing the buffer into 8 bits
|
|
BIN
src/C++/main.o
BIN
src/C++/main.o
Binary file not shown.
@@ -1,18 +0,0 @@
|
|||||||
#clean this up for seperate build folder
|
|
||||||
CPPFLAGS = -Wall -I./include
|
|
||||||
CC=g++
|
|
||||||
|
|
||||||
#target : main.o
|
|
||||||
# g++ * -Wall
|
|
||||||
progr: main.o
|
|
||||||
$(CC) $^ $(CPPFLAGS) -o progr #S^ stands for all dependencies
|
|
||||||
@echo "ready"
|
|
||||||
|
|
||||||
main.o: main.cpp #may be omitted (implicit rule)
|
|
||||||
$(CC) $(CPPFLAGS) -c -o main.o main.cpp
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm progr
|
|
||||||
rm *.o
|
|
||||||
|
|
||||||
|
|
BIN
src/C++/progr
BIN
src/C++/progr
Binary file not shown.
Reference in New Issue
Block a user