mirror of
https://github.com/Wessel/Roommapper.git
synced 2026-07-22 07:47:10 +02:00
feat: Voeg routeplanner route toe
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="dataSourceStorageLocal" created-in="RD-241.14494.307">
|
||||
<component name="dataSourceStorageLocal" created-in="RD-233.15026.31">
|
||||
<data-source name="roommapper@localhost" uuid="469f6bec-f113-4467-9d39-7ac38558045a">
|
||||
<database-info product="Cassandra" version="3.0.8" jdbc-version="4.2" driver-name="Cassandra JDBC Driver" driver-version="1.4" dbms="CASSANDRA" exact-version="3.0.8" exact-driver-version="1.4">
|
||||
<identifier-quote-string>"</identifier-quote-string>
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dataSource name="roommapper@localhost">
|
||||
<database-model serializer="dbm" dbms="CASSANDRA" family-id="CASSANDRA" format-version="4.52">
|
||||
<root id="1">
|
||||
<ServerVersion>3.0.8</ServerVersion>
|
||||
</root>
|
||||
<role id="2" parent="1" name="cassandra">
|
||||
<CanLogin>1</CanLogin>
|
||||
<SuperRole>1</SuperRole>
|
||||
</role>
|
||||
<schema id="3" parent="1" name="roommapper">
|
||||
<Current>1</Current>
|
||||
<Properties>durable_writes:true
|
||||
replication:{'class': 'org.apache.cassandra.locator.NetworkTopologyStrategy', 'datacenter1': '1'}
|
||||
</Properties>
|
||||
</schema>
|
||||
<schema id="4" parent="1" name="system">
|
||||
<Properties>durable_writes:true
|
||||
replication:{'class': 'org.apache.cassandra.locator.LocalStrategy'}
|
||||
</Properties>
|
||||
</schema>
|
||||
<schema id="5" parent="1" name="system_auth">
|
||||
<Properties>durable_writes:true
|
||||
replication:{'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1'}
|
||||
</Properties>
|
||||
</schema>
|
||||
<schema id="6" parent="1" name="system_distributed">
|
||||
<Properties>durable_writes:true
|
||||
replication:{'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'}
|
||||
</Properties>
|
||||
</schema>
|
||||
<schema id="7" parent="1" name="system_distributed_everywhere">
|
||||
<Properties>durable_writes:true
|
||||
replication:{'class': 'org.apache.cassandra.locator.EverywhereStrategy'}
|
||||
</Properties>
|
||||
</schema>
|
||||
<schema id="8" parent="1" name="system_schema">
|
||||
<Properties>durable_writes:true
|
||||
replication:{'class': 'org.apache.cassandra.locator.LocalStrategy'}
|
||||
</Properties>
|
||||
</schema>
|
||||
<schema id="9" parent="1" name="system_traces">
|
||||
<Properties>durable_writes:true
|
||||
replication:{'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '2'}
|
||||
</Properties>
|
||||
</schema>
|
||||
</database-model>
|
||||
</dataSource>
|
||||
@@ -58,13 +58,13 @@
|
||||
"cassandra"
|
||||
],
|
||||
"rider.external.source.directories": [
|
||||
"C:\\Users\\wesse\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\wesse\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\wesse\\AppData\\Local\\Symbols\\src"
|
||||
"C:\\Users\\Wessel\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\Wessel\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\Wessel\\AppData\\Local\\Symbols\\src"
|
||||
]
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager" selected=".NET Project.Console">
|
||||
<component name="RunManager">
|
||||
<configuration name="Console" type="DotNetProject" factoryName=".NET Project">
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/Console/bin/Debug/net8.0/Console.exe" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
@@ -117,6 +117,7 @@
|
||||
<workItem from="1717673464254" duration="1428000" />
|
||||
<workItem from="1718093417281" duration="4387000" />
|
||||
<workItem from="1718443610193" duration="8513000" />
|
||||
<workItem from="1719219142765" duration="850000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibParse", "LibParse\LibPar
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{56E0FEEA-8155-4979-8E90-EF2F3DA4B9E4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoveragePathPlanner", "..\CoveragePathPlanner\CoveragePathPlanner.csproj", "{5AB45288-CD7F-45E6-AA61-10FBC92EAEAB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -33,6 +35,10 @@ Global
|
||||
{56E0FEEA-8155-4979-8E90-EF2F3DA4B9E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{56E0FEEA-8155-4979-8E90-EF2F3DA4B9E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{56E0FEEA-8155-4979-8E90-EF2F3DA4B9E4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5AB45288-CD7F-45E6-AA61-10FBC92EAEAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5AB45288-CD7F-45E6-AA61-10FBC92EAEAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5AB45288-CD7F-45E6-AA61-10FBC92EAEAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5AB45288-CD7F-45E6-AA61-10FBC92EAEAB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -14,6 +14,7 @@ internal static class Program {
|
||||
{ "database", new RouteDatabase(cassandraSession) },
|
||||
{ "database/metadata", new RouteMetadata(cassandraSession) },
|
||||
{ "database/path", new RoutePath(cassandraSession) },
|
||||
{ "database/path/plan", new RoutePlan() },
|
||||
{ "roomba/control", new RouteControl() }
|
||||
};
|
||||
|
||||
|
||||
34
src/Server/RobotControlServer/Routes/RoutePlan.cs
Normal file
34
src/Server/RobotControlServer/Routes/RoutePlan.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Cassandra;
|
||||
using LibParse.Json;
|
||||
using LibServer.Http;
|
||||
using LibServer.Router;
|
||||
using RobotControlServer.JsonClasses;
|
||||
|
||||
namespace RobotControlServer.Routes;
|
||||
|
||||
public class RoutePlan: IRoute {
|
||||
/// <summary>
|
||||
/// POST request for the database/path/plan route, generate a new path
|
||||
/// from a certain map of objects.
|
||||
/// </summary>
|
||||
public HttpResponse Post(HttpRequest request) {
|
||||
try {
|
||||
// Parse request body to Data object, give error if non-nullable fields
|
||||
// are null.
|
||||
var parsedBody = request.Body?.FromJson<Data>();
|
||||
if (parsedBody?.objects == null) {
|
||||
throw new Exception("objectData is null");
|
||||
}
|
||||
|
||||
// ParsedBody?.objects = [[0,1],[0,2],...]
|
||||
// Implement path planning algorithm
|
||||
// var path;
|
||||
|
||||
// Return success message with the path
|
||||
return new HttpResponse($"{{\"message\":\"success\",\"path\":\"{path}\"}}");
|
||||
} catch (Exception ex) {
|
||||
// Return error message if failed for any reason
|
||||
return new HttpResponse($"{{\"message\": \"{ex.Message.Replace("\"", "\\\"")}\"}}", 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user