mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-05 12:54:57 +00:00
Compare commits
7 Commits
82c4381143
...
8a5b349040
Author | SHA1 | Date | |
---|---|---|---|
|
8a5b349040 | ||
|
a41ea1b70c | ||
eb804c888c | |||
a028a6f88f | |||
47b29a1c55 | |||
528de4f3f4 | |||
|
c16ba3cf9d |
@@ -572,10 +572,10 @@ void CKobuki::Rotate(int degrees) {
|
|||||||
float radians = degrees * PI / 180.0;
|
float radians = degrees * PI / 180.0;
|
||||||
|
|
||||||
// Calculate the rotation speed in radians per second
|
// Calculate the rotation speed in radians per second
|
||||||
double radpersec = 1;
|
double RADS_PER_SEC = 1;
|
||||||
|
|
||||||
// calculator rotation time and give absolute value
|
// calculator rotation time and give absolute value
|
||||||
float rotation_time = std::abs(radians / radpersec);
|
float rotation_time = std::abs(radians / RADS_PER_SEC);
|
||||||
|
|
||||||
// Use original function to set the rotation speed in mm/s
|
// Use original function to set the rotation speed in mm/s
|
||||||
setRotationSpeed(radians);
|
setRotationSpeed(radians);
|
||||||
|
@@ -9,7 +9,8 @@ using namespace std;
|
|||||||
CKobuki robot;
|
CKobuki robot;
|
||||||
std::string readMQTT();
|
std::string readMQTT();
|
||||||
void parseMQTT(std::string message);
|
void parseMQTT(std::string message);
|
||||||
MqttClient client("mqtt://145.92.224.21:1883", "KobukiRPI", "ishak", "kobuki"); // create a client object
|
//ip, clientID, username, password
|
||||||
|
MqttClient client("mqtt://145.92.224.21:1884", "KobukiRPI", "rpi", "rpiwachtwoordofzo"); // create a client object
|
||||||
std::string message = "stop";
|
std::string message = "stop";
|
||||||
std::string serializeKobukiData(const TKobukiData &data);
|
std::string serializeKobukiData(const TKobukiData &data);
|
||||||
void sendKobukiData(TKobukiData &data);
|
void sendKobukiData(TKobukiData &data);
|
||||||
@@ -149,6 +150,64 @@ void logToFile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sendIndividualKobukiData(const TKobukiData &data) {
|
||||||
|
while (true) {
|
||||||
|
client.publishMessage("kobuki/data/timestamp", std::to_string(data.timestamp));
|
||||||
|
client.publishMessage("kobuki/data/BumperCenter", std::to_string(data.BumperCenter));
|
||||||
|
client.publishMessage("kobuki/data/BumperLeft", std::to_string(data.BumperLeft));
|
||||||
|
client.publishMessage("kobuki/data/BumperRight", std::to_string(data.BumperRight));
|
||||||
|
client.publishMessage("kobuki/data/WheelDropLeft", std::to_string(data.WheelDropLeft));
|
||||||
|
client.publishMessage("kobuki/data/WheelDropRight", std::to_string(data.WheelDropRight));
|
||||||
|
client.publishMessage("kobuki/data/CliffCenter", std::to_string(data.CliffCenter));
|
||||||
|
client.publishMessage("kobuki/data/CliffLeft", std::to_string(data.CliffLeft));
|
||||||
|
client.publishMessage("kobuki/data/CliffRight", std::to_string(data.CliffRight));
|
||||||
|
client.publishMessage("kobuki/data/EncoderLeft", std::to_string(data.EncoderLeft));
|
||||||
|
client.publishMessage("kobuki/data/EncoderRight", std::to_string(data.EncoderRight));
|
||||||
|
client.publishMessage("kobuki/data/PWMleft", std::to_string(data.PWMleft));
|
||||||
|
client.publishMessage("kobuki/data/PWMright", std::to_string(data.PWMright));
|
||||||
|
client.publishMessage("kobuki/data/ButtonPress1", std::to_string(data.ButtonPress1));
|
||||||
|
client.publishMessage("kobuki/data/ButtonPress2", std::to_string(data.ButtonPress2));
|
||||||
|
client.publishMessage("kobuki/data/ButtonPress3", std::to_string(data.ButtonPress3));
|
||||||
|
client.publishMessage("kobuki/data/Charger", std::to_string(data.Charger));
|
||||||
|
client.publishMessage("kobuki/data/Battery", std::to_string(data.Battery));
|
||||||
|
client.publishMessage("kobuki/data/overCurrent", std::to_string(data.overCurrent));
|
||||||
|
client.publishMessage("kobuki/data/IRSensorRight", std::to_string(data.IRSensorRight));
|
||||||
|
client.publishMessage("kobuki/data/IRSensorCenter", std::to_string(data.IRSensorCenter));
|
||||||
|
client.publishMessage("kobuki/data/IRSensorLeft", std::to_string(data.IRSensorLeft));
|
||||||
|
client.publishMessage("kobuki/data/GyroAngle", std::to_string(data.GyroAngle));
|
||||||
|
client.publishMessage("kobuki/data/GyroAngleRate", std::to_string(data.GyroAngleRate));
|
||||||
|
client.publishMessage("kobuki/data/CliffSensorRight", std::to_string(data.CliffSensorRight));
|
||||||
|
client.publishMessage("kobuki/data/CliffSensorCenter", std::to_string(data.CliffSensorCenter));
|
||||||
|
client.publishMessage("kobuki/data/CliffSensorLeft", std::to_string(data.CliffSensorLeft));
|
||||||
|
client.publishMessage("kobuki/data/wheelCurrentLeft", std::to_string(data.wheelCurrentLeft));
|
||||||
|
client.publishMessage("kobuki/data/wheelCurrentRight", std::to_string(data.wheelCurrentRight));
|
||||||
|
client.publishMessage("kobuki/data/digitalInput", std::to_string(data.digitalInput));
|
||||||
|
client.publishMessage("kobuki/data/analogInputCh0", std::to_string(data.analogInputCh0));
|
||||||
|
client.publishMessage("kobuki/data/analogInputCh1", std::to_string(data.analogInputCh1));
|
||||||
|
client.publishMessage("kobuki/data/analogInputCh2", std::to_string(data.analogInputCh2));
|
||||||
|
client.publishMessage("kobuki/data/analogInputCh3", std::to_string(data.analogInputCh3));
|
||||||
|
client.publishMessage("kobuki/data/frameId", std::to_string(data.frameId));
|
||||||
|
client.publishMessage("kobuki/data/extraInfo/HardwareVersionPatch", std::to_string(data.extraInfo.HardwareVersionPatch));
|
||||||
|
client.publishMessage("kobuki/data/extraInfo/HardwareVersionMinor", std::to_string(data.extraInfo.HardwareVersionMinor));
|
||||||
|
client.publishMessage("kobuki/data/extraInfo/HardwareVersionMajor", std::to_string(data.extraInfo.HardwareVersionMajor));
|
||||||
|
client.publishMessage("kobuki/data/extraInfo/FirmwareVersionPatch", std::to_string(data.extraInfo.FirmwareVersionPatch));
|
||||||
|
client.publishMessage("kobuki/data/extraInfo/FirmwareVersionMinor", std::to_string(data.extraInfo.FirmwareVersionMinor));
|
||||||
|
client.publishMessage("kobuki/data/extraInfo/FirmwareVersionMajor", std::to_string(data.extraInfo.FirmwareVersionMajor));
|
||||||
|
client.publishMessage("kobuki/data/extraInfo/UDID0", std::to_string(data.extraInfo.UDID0));
|
||||||
|
client.publishMessage("kobuki/data/extraInfo/UDID1", std::to_string(data.extraInfo.UDID1));
|
||||||
|
client.publishMessage("kobuki/data/extraInfo/UDID2", std::to_string(data.extraInfo.UDID2));
|
||||||
|
|
||||||
|
if (!data.gyroData.empty()) {
|
||||||
|
const auto& latestGyro = data.gyroData.back();
|
||||||
|
client.publishMessage("kobuki/data/gyroData/x", std::to_string(latestGyro.x));
|
||||||
|
client.publishMessage("kobuki/data/gyroData/y", std::to_string(latestGyro.y));
|
||||||
|
client.publishMessage("kobuki/data/gyroData/z", std::to_string(latestGyro.z));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string serializeKobukiData(const TKobukiData &data) {
|
std::string serializeKobukiData(const TKobukiData &data) {
|
||||||
std::string json = "{\"timestamp\":" + std::to_string(data.timestamp) +
|
std::string json = "{\"timestamp\":" + std::to_string(data.timestamp) +
|
||||||
",\"BumperCenter\":" + std::to_string(data.BumperCenter) +
|
",\"BumperCenter\":" + std::to_string(data.BumperCenter) +
|
||||||
|
@@ -9,8 +9,8 @@ def on_message(client, userdata, message):
|
|||||||
|
|
||||||
# Create an MQTT client instance
|
# Create an MQTT client instance
|
||||||
mqtt_client = mqtt.Client()
|
mqtt_client = mqtt.Client()
|
||||||
mqtt_client.username_pw_set("ishak", "kobuki")
|
mqtt_client.username_pw_set("server", "serverwachtwoordofzo")
|
||||||
mqtt_client.connect("localhost", 1883, 60)
|
mqtt_client.connect("localhost", 1884, 60)
|
||||||
mqtt_client.loop_start()
|
mqtt_client.loop_start()
|
||||||
mqtt_client.subscribe("kobuki/data")
|
mqtt_client.subscribe("kobuki/data")
|
||||||
mqtt_client.on_message = on_message # this lines needs to be under the function definition otherwise it cant find which function it needs to use
|
mqtt_client.on_message = on_message # this lines needs to be under the function definition otherwise it cant find which function it needs to use
|
||||||
|
BIN
src/Python/flask/web/static/images/logo.png
Normal file
BIN
src/Python/flask/web/static/images/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 200 KiB |
@@ -23,6 +23,22 @@ body {
|
|||||||
right: 0%;
|
right: 0%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
max-width: 80%;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #f0f0f0;
|
||||||
|
border-radius: 50px;
|
||||||
|
align-items: center;
|
||||||
|
margin: 1.5rem auto 0 auto;
|
||||||
|
padding: 0 30px;
|
||||||
|
top: 0%;
|
||||||
|
bottom: auto;
|
||||||
|
left: 0%;
|
||||||
|
right: 0%;
|
||||||
|
}
|
||||||
|
|
||||||
.imgNav {
|
.imgNav {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
@@ -73,6 +89,18 @@ body {
|
|||||||
transition: transform 0.2s ease, background-color 0.2s ease;
|
transition: transform 0.2s ease, background-color 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text{
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image{
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sectionHeight{
|
||||||
|
height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Direction buttons */
|
/* Direction buttons */
|
||||||
.btn:nth-child(1) {
|
.btn:nth-child(1) {
|
||||||
/* Left */
|
/* Left */
|
||||||
|
@@ -43,16 +43,6 @@ section h2 {
|
|||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
|
||||||
background-color: #333;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
padding: 1rem 0;
|
|
||||||
position: fixed;
|
|
||||||
width: 100%;
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
form {
|
form {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
@@ -11,5 +11,6 @@
|
|||||||
{% include 'navbar.html' %}
|
{% include 'navbar.html' %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
21
src/Python/flask/web/templates/footer.html
Normal file
21
src/Python/flask/web/templates/footer.html
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<footer class="footer">
|
||||||
|
<img src="{{url_for('static', filename='images/logo_kobuki.png')}}" alt="logo" class="imgNav" />
|
||||||
|
<h3>© 2024 Kobuki Robot Project. All rights reserved.</h3>
|
||||||
|
<div class="buttonContainer">
|
||||||
|
<a href="{{ url_for('control') }}" target="_blank">
|
||||||
|
<button class="click connectButton">Controller</button>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -1,32 +1,33 @@
|
|||||||
|
{% extends 'base.html' %} {% block head %}
|
||||||
|
<link rel="stylesheet" href="../static/style.css" />
|
||||||
|
{% endblock %} {% block content %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Kobuki Robot Project</title>
|
<title>Kobuki Robot Project</title>
|
||||||
<link rel="stylesheet" href="../static/styleIndex.css" />
|
<link rel="stylesheet" href="../static/style.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<section class="container sectionHeight">
|
||||||
<h1>Welcome to the Kobuki Robot Project</h1>
|
<p class="text">
|
||||||
<nav>
|
The Kobuki Robot Project is an innovative initiative aimed at developing
|
||||||
<ul>
|
a versatile and intelligent robot platform. Our goal is to create a
|
||||||
<li><a href="#home">Home</a></li>
|
robot that can navigate autonomously, interact with its environment, and
|
||||||
<li><a href="#about">About</a></li>
|
perform various tasks.
|
||||||
<li><a href="#contact">Contact</a></li>
|
</p>
|
||||||
</ul>
|
<img src="{{url_for('static', filename='images/logo.png')}}" alt="logo" class="image" />
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<section id="home">
|
|
||||||
<h2>Introduction</h2>
|
|
||||||
<p>The Kobuki Robot Project is an innovative initiative aimed at developing a versatile and intelligent robot platform. Our goal is to create a robot that can navigate autonomously, interact with its environment, and perform various tasks.</p>
|
|
||||||
<img src="static/kobuki.jpg" alt="Kobuki Robot">
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="about">
|
<section class="container sectionHeight" id="about">
|
||||||
<h2>About the Project</h2>
|
<h2>About the Project</h2>
|
||||||
<p>This project is a collaborative effort involving engineers, researchers, and enthusiasts. The Kobuki robot is equipped with various sensors, including bumpers, cliff sensors, and gyroscopes, to help it navigate and interact with its surroundings.</p>
|
<p>
|
||||||
|
This project is a collaborative effort involving engineers, researchers,
|
||||||
|
and enthusiasts. The Kobuki robot is equipped with various sensors,
|
||||||
|
including bumpers, cliff sensors, and gyroscopes, to help it navigate
|
||||||
|
and interact with its surroundings.
|
||||||
|
</p>
|
||||||
<p>Key features of the Kobuki Robot:</p>
|
<p>Key features of the Kobuki Robot:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Autonomous navigation</li>
|
<li>Autonomous navigation</li>
|
||||||
@@ -36,23 +37,22 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="contact">
|
<section class="container" id="contact">
|
||||||
<h2>Contact Us</h2>
|
<h2>Contact Us</h2>
|
||||||
<form id="contact-form" action="/contact" method="post">
|
<form id="contact-form" action="/contact" method="post">
|
||||||
<label for="name">Name:</label>
|
<label for="name">Name:</label>
|
||||||
<input type="text" id="name" name="name" required>
|
<input type="text" id="name" name="name" required />
|
||||||
<label for="email">Email:</label>
|
<label for="email">Email:</label>
|
||||||
<input type="email" id="email" name="email" required>
|
<input type="email" id="email" name="email" required />
|
||||||
<label for="message">Message:</label>
|
<label for="message">Message:</label>
|
||||||
<textarea id="message" name="message" required></textarea>
|
<textarea id="message" name="message" required></textarea>
|
||||||
<button type="submit">Send</button>
|
<button type="submit">Send</button>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer>
|
{% include 'footer.html' %}
|
||||||
<p>© 2023 Kobuki Robot Project. All rights reserved.</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="static/script.js"></script>
|
<script src="static/script.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
{% endblock %}
|
||||||
|
@@ -11,13 +11,9 @@
|
|||||||
<img src="{{url_for('static', filename='images/logo_kobuki.png')}}" alt="logo" class="imgNav" />
|
<img src="{{url_for('static', filename='images/logo_kobuki.png')}}" alt="logo" class="imgNav" />
|
||||||
<h3>Kobuki</h3>
|
<h3>Kobuki</h3>
|
||||||
<div class="buttonContainer">
|
<div class="buttonContainer">
|
||||||
<a
|
<a href="{{ url_for('control') }}" target="_blank">
|
||||||
href="https://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-3/vuupoofeehoo27"
|
<button class="click connectButton">Controller</button>
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
<button class="click connectButton">Placeholder</button>
|
|
||||||
</a>
|
</a>
|
||||||
<!-- <a href="./signup.html">sign in</a> -->
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user