changed comments to english

This commit is contained in:
ishak jmilou.ishak
2024-09-26 15:48:49 +02:00
parent dc3833dcac
commit 7c922ae3fd

View File

@@ -1,13 +1,13 @@
//#pragma once
////*************************************************************************************
////*************************************************************************************
//// autor Martin Dekan a Peter Beno mail: dekdekan@gmail.com, peter.beno@stuba.sk
//// author Martin Dekan and Peter Beno mail: dekdekan@gmail.com, peter.beno@stuba.sk
////-------------------------------------------------------------------------------------
//// co to je:
//// trieda na pracu s robotom kobuki. mala by mat implementovane citanie dat
//// a posielanie prikazov...
//// neobsahuje ziadnu logiku co s datami robit, to je na userovi aby spravil v callback funkcii
// jedna sa vlastne len o implementaciu komunikacie s hardwareom, driver
//// what it is:
//// class for working with the kobuki robot. it should have implemented data reading
//// and sending commands...
//// it does not contain any logic on what to do with the data, it is up to the user to do it in the callback function
//// it is basically just an implementation of communication with the hardware, driver
////*************************************************************************************
////*************************************************************************************
#ifndef KOBUKI_CLASS_123456789
@@ -67,9 +67,9 @@ typedef struct
typedef struct
{
//---zakladny balik
//---basic package
unsigned short timestamp;
//narazniky
//bumpers
bool BumperLeft;
bool BumperCenter;
bool BumperRight;
@@ -77,17 +77,17 @@ typedef struct
bool CliffLeft;
bool CliffCenter;
bool CliffRight;
// padnutie kolies
// wheel drop
bool WheelDropLeft;
bool WheelDropRight;
//tocenie kolies
//wheel rotation
unsigned short EncoderRight;
unsigned short EncoderLeft;
unsigned char PWMright;
unsigned char PWMleft;
//gombiky
unsigned char ButtonPress;// 0 nie, 1 2 4 pre button 0 1 2 (7 je ze vsetky tri)
//napajanie
//buttons
unsigned char ButtonPress;// 0 no, 1 2 4 for button 0 1 2 (7 is all three)
//power
unsigned char Charger;
unsigned char Battery;
unsigned char overCurrent;
@@ -114,7 +114,7 @@ typedef struct
unsigned short analogInputCh1;
unsigned short analogInputCh2;
unsigned short analogInputCh3;
//---struktura s datami ktore sa nam tam objavia iba na poziadanie
//---structure with data that appears only on request
TExtraRequestData extraInfo;
}TKobukiData;
@@ -127,11 +127,11 @@ public:
CKobuki() {
stopVlakno = 0;
std::cout << "kobuki instantiated" << std::endl;
odometry_log.open("odometry.txt");
odometry_log.open("odometry.txt");
};
virtual ~CKobuki() {
stopVlakno = 1;
close(HCom);
close(HCom);
pthread_cancel(threadHandle);
odometry_log.close();
};
@@ -144,8 +144,8 @@ public:
long loop(void *user_data, TKobukiData &Kobuki_data);
void startCommunication(char *portname,bool CommandsEnabled,void *userDataL);
int measure(); //vlaknova funkcia, ma v sebe nekonecne vlakno a vycitava udaje
void setLed(int led1 = 0, int led2 = 0); //led1 zelena/cervena 2/1, //led2 zelena/cervena 2/1
int measure(); //thread function, contains an infinite loop and reads data
void setLed(int led1 = 0, int led2 = 0); //led1 green/red 2/1, //led2 green/red 2/1
void setTranslationSpeed(int mmpersec);
void setRotationSpeed(double radpersec);
void setArcSpeed(int mmpersec,int radius);
@@ -162,11 +162,10 @@ public:
private:
int HCom;
pthread_t threadHandle; // handle na vlakno
int threadID; // id vlakna
pthread_t threadHandle; // handle to the thread
int threadID; // thread id
int stopVlakno;
src_callback_kobuki_data callbackFunction;
void *userData;
@@ -176,12 +175,12 @@ private:
unsigned char *readKobukiMessage();
int checkChecksum(unsigned char *data);
//--spustenie merania v novom vlakne (vycitavanie bezi v novom vlakne. treba ho stopnut ak chceme poslat request)
//--start measurement in a new thread (reading runs in a new thread. it needs to be stopped if we want to send a request)
static void * KobukiProcess(void *param)
{
//std::cout << "Nase vlakno Kobuki process nastartovalo" << std::endl;
//std::cout << "Our thread Kobuki process started" << std::endl;
CKobuki *hoku = (CKobuki*)param;
int vystup = hoku->measure();
int output = hoku->measure();
return param;
}
@@ -208,16 +207,16 @@ private:
// utilities
long double gyroToRad(signed short GyroAngle);
// plot p;
std::vector<float> vectorX;
std::vector<float> vectorY;
std::vector<float> vectorGyroTheta;
// plot p;
std::vector<float> vectorX;
std::vector<float> vectorY;
std::vector<float> vectorGyroTheta;
double displacement = 0;
double integratedGyroTheta = 0;
double gx = 0;
double gy = 0;
double displacement = 0;
double integratedGyroTheta = 0;
double gx = 0;
double gy = 0;
};