Added placeholder webite for main website

This commit is contained in:
2024-11-12 14:30:45 +01:00
parent 0e30854b51
commit 661fdb9d26
4 changed files with 193 additions and 48 deletions

View File

@@ -15,11 +15,15 @@ mqtt_client.loop_start()
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
@app.route('/', methods=["GET","POST"])
@app.route('/')
def index():
return render_template('index.html')
@app.route('/control', methods=["GET","POST"])
def control():
if request.authorization and request.authorization.username == 'ishak' and request.authorization.password == 'kobuki':
return render_template('index.html')
return render_template('control.html')
else:
return ('Unauthorized', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})

View File

@@ -0,0 +1,83 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
header {
background-color: #333;
color: #fff;
padding: 1rem 0;
text-align: center;
}
header h1 {
margin: 0;
}
nav ul {
list-style: none;
padding: 0;
}
nav ul li {
display: inline;
margin: 0 1rem;
}
nav ul li a {
color: #fff;
text-decoration: none;
}
section {
padding: 2rem;
margin: 1rem 0;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
section h2 {
margin-top: 0;
}
footer {
background-color: #333;
color: #fff;
text-align: center;
padding: 1rem 0;
position: fixed;
width: 100%;
bottom: 0;
}
form {
display: flex;
flex-direction: column;
}
form label {
margin: 0.5rem 0 0.2rem;
}
form input, form textarea {
padding: 0.5rem;
margin-bottom: 1rem;
border: 1px solid #ccc;
border-radius: 4px;
}
form button {
padding: 0.7rem;
border: none;
border-radius: 4px;
background-color: #333;
color: #fff;
cursor: pointer;
}
form button:hover {
background-color: #555;
}

View File

@@ -0,0 +1,48 @@
{% extends 'base.html' %} {% block head %}
<link rel="stylesheet" href="../static/style.css" />
{% endblock %} {% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Kobuki</title>
<link rel="stylesheet" href="../static/style.css" />
</head>
<body>
<div class="container">
<div class="image-section">
<img src="kobuki.jpg" alt="Kobuki Robot" id="robot-image" />
</div>
<div class="button-section">
<form id="form" action="/move" method="post">
<button class="btn" name="direction" value="left"></button>
<button class="btn" name="direction" value="up"></button>
<button class="btn" name="direction" value="right"></button>
<button class="btn" name="direction" value="down"></button>
<button class="btn stop-button" name="direction" value="stop">
Stop
</button>
</form>
</div>
</div>
<div class="container">
<h1>Sensor Data</h1>
<div class="data">
<table id="sensor-data"> <!-- Do not change -->
<thead>
<tr>
<th>Sensor</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<!-- Sensor data rows will be inserted here -->
</tbody>
</table>
</div>
</div>
<script src="../static/script.js"></script>
</body>
</html>
{% endblock %}

View File

@@ -1,48 +1,58 @@
{% extends 'base.html' %} {% block head %}
<link rel="stylesheet" href="../static/style.css" />
{% endblock %} {% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Kobuki</title>
<link rel="stylesheet" href="../static/style.css" />
</head>
<body>
<div class="container">
<div class="image-section">
<img src="kobuki.jpg" alt="Kobuki Robot" id="robot-image" />
</div>
<div class="button-section">
<form id="form" action="/move" method="post">
<button class="btn" name="direction" value="left"></button>
<button class="btn" name="direction" value="up"></button>
<button class="btn" name="direction" value="right"></button>
<button class="btn" name="direction" value="down"></button>
<button class="btn stop-button" name="direction" value="stop">
Stop
</button>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kobuki Robot Project</title>
<link rel="stylesheet" href="../static/styleIndex.css" />
</head>
<body>
<header>
<h1>Welcome to the Kobuki Robot Project</h1>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</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 id="about">
<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>Key features of the Kobuki Robot:</p>
<ul>
<li>Autonomous navigation</li>
<li>Obstacle detection and avoidance</li>
<li>Real-time data processing</li>
<li>Remote control and monitoring</li>
</ul>
</section>
<section id="contact">
<h2>Contact Us</h2>
<form id="contact-form" action="/contact" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
<button type="submit">Send</button>
</form>
</div>
</div>
<div class="container">
<h1>Sensor Data</h1>
<div class="data">
<table id="sensor-data"> <!-- Do not change -->
<thead>
<tr>
<th>Sensor</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<!-- Sensor data rows will be inserted here -->
</tbody>
</table>
</div>
</div>
<script src="../static/script.js"></script>
</body>
</html>
{% endblock %}
</section>
<footer>
<p>&copy; 2023 Kobuki Robot Project. All rights reserved.</p>
</footer>
<script src="static/script.js"></script>
</body>
</html>