diff --git a/src/C++/Driver/src/KobukiDriver/CKobuki.cpp b/src/C++/Driver/src/KobukiDriver/CKobuki.cpp index 258f384..429e7f9 100755 --- a/src/C++/Driver/src/KobukiDriver/CKobuki.cpp +++ b/src/C++/Driver/src/KobukiDriver/CKobuki.cpp @@ -535,6 +535,8 @@ void CKobuki::goToXy(long double xx, long double yy) { return; } +/// @brief Makes the robot move forward for 3 seconds +/// @param speedvalue How fast it will drive forward from 0 - 1024 void CKobuki::forward(int speedvalue) { // Use the goStraight logic to determine the speed and distance @@ -588,6 +590,10 @@ void CKobuki::Rotate(int degrees) { setRotationSpeed(0); } + +/// @brief Robot safety function to be ran in another thread. Makes sure the robot does not throw inteself from the table. Only use this when the speed is lower than 350 +/// @param pointerToMessage Set this pointer to the control message and then it attempts to reset it when it bumps into something so it doesnt keep trying to do the past commant +// TODO: make this return bool so it can be used in the control part void CKobuki::robotSafety(std::string *pointerToMessage) { while (true) { @@ -602,6 +608,7 @@ void CKobuki::robotSafety(std::string *pointerToMessage) { } } +/// @brief Robot safety function to be ran in another thread. Makes sure the robot does not throw inteself from the table. Only use this when the speed is lower than 350 void CKobuki::robotSafety() { while (true) { @@ -614,6 +621,7 @@ void CKobuki::robotSafety() { } } +/// @brief When called the robot gets a control message to stop whatever its doing void CKobuki::sendNullMessage() { unsigned char message[11] = { diff --git a/src/C++/Driver/src/MQTT/MqttClient.cpp b/src/C++/Driver/src/MQTT/MqttClient.cpp index d149c75..7386cb2 100644 --- a/src/C++/Driver/src/MQTT/MqttClient.cpp +++ b/src/C++/Driver/src/MQTT/MqttClient.cpp @@ -2,6 +2,7 @@ MqttClient::MqttClient(const std::string& address, const std::string& clientId, const std::string& username, const std::string& password) //client_ is the connection + //here all the @PARAMS are getting set for the connection : client_(address, clientId), username_(username), password_(password), callback_(*this) { client_.set_callback(callback_); options.set_clean_session(true); diff --git a/src/C++/Driver/src/MQTT/example.cpp b/src/C++/Driver/src/MQTT/example.cpp index b166518..87e403e 100644 --- a/src/C++/Driver/src/MQTT/example.cpp +++ b/src/C++/Driver/src/MQTT/example.cpp @@ -1,5 +1,5 @@ #include "MqttClient.h" - +//example file for testing int main(){ MqttClient client("mqtt://localhost:1883", "raspberry_pi_client", "ishak", "kobuki"); client.connect(); diff --git a/src/C++/Driver/src/main.cpp b/src/C++/Driver/src/main.cpp index 059e8e2..b1ba02f 100644 --- a/src/C++/Driver/src/main.cpp +++ b/src/C++/Driver/src/main.cpp @@ -19,6 +19,7 @@ void setup() { unsigned char *null_ptr(0); robot.startCommunication("/dev/ttyUSB0", true, null_ptr); + //connect mqtt server and sub to commands client.connect(); client.subscribe("home/commands"); }