Bike follows route
This commit is contained in:
@@ -96,7 +96,7 @@ namespace RH_Engine
|
|||||||
return JsonConvert.SerializeObject(Payload(payload));
|
return JsonConvert.SerializeObject(Payload(payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string addPanel(string serialToSend)
|
public string addPanel(string serialToSend, string uuidBike)
|
||||||
{
|
{
|
||||||
dynamic payload = new
|
dynamic payload = new
|
||||||
{
|
{
|
||||||
@@ -105,6 +105,7 @@ namespace RH_Engine
|
|||||||
data = new
|
data = new
|
||||||
{
|
{
|
||||||
name = "dashboard",
|
name = "dashboard",
|
||||||
|
parent = uuidBike,
|
||||||
components = new
|
components = new
|
||||||
{
|
{
|
||||||
panel = new
|
panel = new
|
||||||
@@ -197,9 +198,9 @@ namespace RH_Engine
|
|||||||
return JsonConvert.SerializeObject(Payload(payload));
|
return JsonConvert.SerializeObject(Payload(payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string AddBikeModel()
|
public string AddBikeModel(string serial)
|
||||||
{
|
{
|
||||||
return AddModel("bike", "addbike", "data\\NetworkEngine\\models\\bike\\bike.fbx");
|
return AddModel("bike", serial, "data\\NetworkEngine\\models\\bike\\bike.fbx");
|
||||||
}
|
}
|
||||||
|
|
||||||
public string AddModel(string nodeName, string serial, string fileLocation)
|
public string AddModel(string nodeName, string serial, string fileLocation)
|
||||||
@@ -335,9 +336,40 @@ namespace RH_Engine
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string FollowRouteCommand()
|
public string RouteFollow(string routeID, string nodeID, float speedValue)
|
||||||
{
|
{
|
||||||
return "";
|
return RouteFollow(routeID, nodeID, speedValue, new float[] { 0, 0, 0 });
|
||||||
|
}
|
||||||
|
|
||||||
|
public string RouteFollow(string routeID, string nodeID, float speedValue, float[] rotateOffsetVector, float[] positionOffsetVector)
|
||||||
|
{
|
||||||
|
return RouteFollow(routeID, nodeID, speedValue, 0, "XYZ", 1, true, rotateOffsetVector, positionOffsetVector);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string RouteFollow(string routeID, string nodeID, float speedValue, float[] positionOffsetVector)
|
||||||
|
{
|
||||||
|
return RouteFollow(routeID, nodeID, speedValue, 0, "XYZ", 1, true, new float[] { 0, 0, 0 }, positionOffsetVector);
|
||||||
|
}
|
||||||
|
private string RouteFollow(string routeID, string nodeID, float speedValue, float offsetValue, string rotateValue, float smoothingValue, bool followHeightValue, float[] rotateOffsetVector, float[] positionOffsetVector)
|
||||||
|
{
|
||||||
|
dynamic payload = new
|
||||||
|
{
|
||||||
|
id = "route/follow",
|
||||||
|
data = new
|
||||||
|
{
|
||||||
|
route = routeID,
|
||||||
|
node = nodeID,
|
||||||
|
speed = speedValue,
|
||||||
|
offset = offsetValue,
|
||||||
|
rotate = rotateValue,
|
||||||
|
smoothing = smoothingValue,
|
||||||
|
followHeight = followHeightValue,
|
||||||
|
rotateOffset = rotateOffsetVector,
|
||||||
|
positionOffset = positionOffsetVector
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return JsonConvert.SerializeObject(Payload(payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RoadCommand(string uuid_route)
|
public string RoadCommand(string uuid_route)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using LibNoise.Primitive;
|
using LibNoise.Primitive;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
@@ -27,6 +27,7 @@ namespace RH_Engine
|
|||||||
private static string tunnelId = string.Empty;
|
private static string tunnelId = string.Empty;
|
||||||
private static string routeId = string.Empty;
|
private static string routeId = string.Empty;
|
||||||
private static string panelId = string.Empty;
|
private static string panelId = string.Empty;
|
||||||
|
private static string bikeId = string.Empty;
|
||||||
|
|
||||||
private static Dictionary<string, HandleSerial> serialResponses = new Dictionary<string, HandleSerial>();
|
private static Dictionary<string, HandleSerial> serialResponses = new Dictionary<string, HandleSerial>();
|
||||||
|
|
||||||
@@ -149,7 +150,15 @@ namespace RH_Engine
|
|||||||
//WriteTextMessage(stream, mainCommand.TerrainCommand(new int[] { 256, 256 }, null));
|
//WriteTextMessage(stream, mainCommand.TerrainCommand(new int[] { 256, 256 }, null));
|
||||||
//string command;
|
//string command;
|
||||||
|
|
||||||
SendMessageAndOnResponse(stream, mainCommand.addPanel("panelID"), "panelID", (message) => panelId = JSONParser.GetResponseUuid(message));
|
SendMessageAndOnResponse(stream, mainCommand.AddBikeModel("bikeID"), "bikeID", (message) => bikeId = JSONParser.GetResponseUuid(message));
|
||||||
|
|
||||||
|
SendMessageAndOnResponse(stream, mainCommand.addPanel("panelID", bikeId), "panelID",
|
||||||
|
(message) =>
|
||||||
|
{
|
||||||
|
panelId = JSONParser.GetResponseUuid(message);
|
||||||
|
while (bikeId == string.Empty) { }
|
||||||
|
WriteTextMessage(stream, mainCommand.RouteFollow(routeId, bikeId, 5, new float[] { 0, -(float)Math.PI / 2f, 0 }, new float[] { 0, 0, 0 }));
|
||||||
|
});
|
||||||
|
|
||||||
Console.WriteLine("id of head " + GetId(Command.STANDARD_HEAD, stream, mainCommand));
|
Console.WriteLine("id of head " + GetId(Command.STANDARD_HEAD, stream, mainCommand));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user