mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 11:55:00 +00:00
Merge branch 'main' of ssh://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79
This commit is contained in:
10
docs/code/code-requirements.md
Normal file
10
docs/code/code-requirements.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Requirements
|
||||
|
||||
1. Het compileerd op x86 en ARM architechturen
|
||||
2. Geen dubbele code
|
||||
3. commentaar bij lastige code
|
||||
4. Doxygen comments bij elke functie, behalve als het duidelijk is in de functienaam
|
||||
5. Hou je code leesbaar
|
||||
6. Geen dode code
|
||||
7. Gebruik TODO comments (TODO TREE)
|
||||
8.
|
@@ -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] = {
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
|
@@ -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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user