Merge commit '8369450d222e304da8eb2d9e345bd8dd894c917f' into V2
This commit is contained in:
commit
c42c253362
@ -61,7 +61,7 @@ PROJECT_BRIEF =
|
|||||||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||||
# the logo to the output directory.
|
# the logo to the output directory.
|
||||||
|
|
||||||
PROJECT_LOGO = //intranet/home/Afbeeldingen/PasserVR/Logos/Logo3NameRight100.png
|
PROJECT_LOGO = //intranet/home/Afbeeldingen/PasserVR/Logos/PasserLife/PasserLifeLogoLeft_300.png
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||||
# into which the generated documentation will be written. If a relative path is
|
# into which the generated documentation will be written. If a relative path is
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Passer.RoboidControl {
|
namespace Passer.RoboidControl {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Passer.RoboidControl {
|
namespace Passer.RoboidControl {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -44,28 +41,6 @@ namespace Passer.RoboidControl {
|
|||||||
buffer[ix++] = this.thingId;
|
buffer[ix++] = this.thingId;
|
||||||
return ix;
|
return ix;
|
||||||
}
|
}
|
||||||
// public override void Deserialize(byte[] buffer) {
|
|
||||||
// uint ix = 0;
|
|
||||||
// this.networkId = buffer[ix++];
|
|
||||||
// this.thingId = buffer[ix++];
|
|
||||||
// }
|
|
||||||
|
|
||||||
//public static bool Send(Participant client, CoreThing thing) {
|
|
||||||
// InvestigateMsg msg = new(thing.networkId, thing.id);
|
|
||||||
// return SendMsg(client, msg);
|
|
||||||
//}
|
|
||||||
// public static async Task<bool> Receive(Stream dataStream, Participant client, byte packetSize) {
|
|
||||||
// if (packetSize != length)
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
// byte[] buffer = await Receive(dataStream, packetSize);
|
|
||||||
// InvestigateMsg msg = new InvestigateMsg(buffer);
|
|
||||||
// //UnityEngine.Debug.Log($"Receive investigate [{msg.networkId}/{msg.thingId}]");
|
|
||||||
|
|
||||||
// client.messageQueue.Enqueue(msg);
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,3 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace Passer.RoboidControl {
|
namespace Passer.RoboidControl {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -23,34 +20,6 @@ namespace Passer.RoboidControl {
|
|||||||
/// <param name="buffer">The buffer to serilize into</param>
|
/// <param name="buffer">The buffer to serilize into</param>
|
||||||
/// <returns>The length of the message in the buffer</returns>
|
/// <returns>The length of the message in the buffer</returns>
|
||||||
public virtual byte Serialize(ref byte[] buffer) { return 0; }
|
public virtual byte Serialize(ref byte[] buffer) { return 0; }
|
||||||
|
|
||||||
//public virtual void Deserialize(byte[] buffer) { }
|
|
||||||
|
|
||||||
// public bool SendTo(Participant client) {
|
|
||||||
// Serialize(ref client.buffer);
|
|
||||||
// return client.SendBuffer(client.buffer.Length);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public static bool SendMsg(Participant client, IMessage msg) {
|
|
||||||
// msg.Serialize(ref client.buffer);
|
|
||||||
// return client.SendBuffer(client.buffer.Length);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public static bool PublishMsg(Participant client, IMessage msg) {
|
|
||||||
// msg.Serialize(ref client.buffer);
|
|
||||||
// return client.PublishBuffer(client.buffer.Length);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public static async Task<byte[]> Receive(Stream dataStream, byte packetSize) {
|
|
||||||
// byte[] buffer = new byte[packetSize - 1]; // without msgId
|
|
||||||
// int byteCount = dataStream.Read(buffer, 0, packetSize - 1);
|
|
||||||
// while (byteCount < packetSize - 1) {
|
|
||||||
// // not all bytes have been read, wait and try again
|
|
||||||
// await Task.Delay(1);
|
|
||||||
// byteCount += dataStream.Read(buffer, byteCount, packetSize - 1 - byteCount);
|
|
||||||
// }
|
|
||||||
// return buffer;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,52 @@
|
|||||||
namespace Passer.RoboidControl {
|
namespace Passer.RoboidControl {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Message for communicating the URL for a model of the thing
|
||||||
|
/// </summary>
|
||||||
public class ModelUrlMsg : IMessage {
|
public class ModelUrlMsg : IMessage {
|
||||||
|
/// <summary>
|
||||||
|
/// The message ID
|
||||||
|
/// </summary>
|
||||||
public const byte Id = 0x90; // (144) Model URL
|
public const byte Id = 0x90; // (144) Model URL
|
||||||
|
/// <summary>
|
||||||
|
/// The length of the message without th URL itself
|
||||||
|
/// </summary>
|
||||||
public const byte length = 4;
|
public const byte length = 4;
|
||||||
|
/// <summary>
|
||||||
|
/// The network ID of the thing
|
||||||
|
/// </summary>
|
||||||
public byte networkId;
|
public byte networkId;
|
||||||
|
/// <summary>
|
||||||
|
/// The ID of the thing
|
||||||
|
/// </summary>
|
||||||
public byte thingId;
|
public byte thingId;
|
||||||
|
/// <summary>
|
||||||
|
/// The URL of the model
|
||||||
|
/// </summary>
|
||||||
public string url = null;
|
public string url = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new message for sending
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="networkId">The network ID of the thing</param>
|
||||||
|
/// <param name="thing">The thing for which to send the model URL</param>
|
||||||
public ModelUrlMsg(byte networkId, Thing thing) {
|
public ModelUrlMsg(byte networkId, Thing thing) {
|
||||||
this.networkId = networkId;
|
this.networkId = networkId;
|
||||||
this.thingId = thing.id;
|
this.thingId = thing.id;
|
||||||
this.url = thing.modelUrl;
|
this.url = thing.modelUrl;
|
||||||
}
|
}
|
||||||
public ModelUrlMsg(byte networkId, byte thingId, string url, float scale = 1) {
|
/// <summary>
|
||||||
|
/// Create a new message for sending
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="networkId">The network ID of the thing</param>
|
||||||
|
/// <param name="thingId">The ID of the thing</param>
|
||||||
|
/// <param name="url">The URL to send</param>
|
||||||
|
public ModelUrlMsg(byte networkId, byte thingId, string url) {
|
||||||
this.networkId = networkId;
|
this.networkId = networkId;
|
||||||
this.thingId = thingId;
|
this.thingId = thingId;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
/// @copydoc Passer::RoboidControl::IMessage::IMessage(byte[] buffer)
|
||||||
public ModelUrlMsg(byte[] buffer) {
|
public ModelUrlMsg(byte[] buffer) {
|
||||||
byte ix = 1;
|
byte ix = 1;
|
||||||
this.networkId = buffer[ix++];
|
this.networkId = buffer[ix++];
|
||||||
@ -26,6 +56,7 @@ namespace Passer.RoboidControl {
|
|||||||
url = System.Text.Encoding.UTF8.GetString(buffer, (int)ix, strlen);
|
url = System.Text.Encoding.UTF8.GetString(buffer, (int)ix, strlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @copydoc Passer::RoboidControl::IMessage::Serialize
|
||||||
public override byte Serialize(ref byte[] buffer) {
|
public override byte Serialize(ref byte[] buffer) {
|
||||||
if (this.url == null)
|
if (this.url == null)
|
||||||
return 0;
|
return 0;
|
@ -9,7 +9,7 @@ namespace Passer.RoboidControl {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const byte Id = 0x91; // 145
|
public const byte Id = 0x91; // 145
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The length of the message
|
/// The length of the message without the name string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const byte length = 4;
|
public const byte length = 4;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -3,6 +3,8 @@ namespace Passer.RoboidControl {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A participant messages notifies other participants of its presence
|
/// A participant messages notifies other participants of its presence
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// When received by another participant, it can be followed by a NetworkIdMsg
|
||||||
|
/// to announce that participant to this client such that it can join privately
|
||||||
public class ParticipantMsg : IMessage {
|
public class ParticipantMsg : IMessage {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The message ID
|
/// The message ID
|
||||||
@ -20,7 +22,7 @@ namespace Passer.RoboidControl {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new message for sending
|
/// Create a new message for sending
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="networkId"></param>
|
/// <param name="networkId">The network ID known by the participant</param>
|
||||||
public ParticipantMsg(byte networkId) {
|
public ParticipantMsg(byte networkId) {
|
||||||
this.networkId = networkId;
|
this.networkId = networkId;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Passer.LinearAlgebra;
|
using Passer.LinearAlgebra;
|
||||||
|
|
||||||
namespace Passer.RoboidControl {
|
namespace Passer.RoboidControl {
|
||||||
@ -27,7 +25,7 @@ namespace Passer.RoboidControl {
|
|||||||
public byte thingId;
|
public byte thingId;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// bitpattern stating which pose components are available
|
/// Bit pattern stating which pose components are available
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte poseType;
|
public byte poseType;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -60,7 +58,7 @@ namespace Passer.RoboidControl {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Spherical linearVelocity = Spherical.zero;
|
public Spherical linearVelocity = Spherical.zero;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The angular veloicty of the thing in local space
|
/// The angular velocity of the thing in local space
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Spherical angularVelocity = Spherical.zero;
|
public Spherical angularVelocity = Spherical.zero;
|
||||||
|
|
||||||
@ -105,59 +103,7 @@ namespace Passer.RoboidControl {
|
|||||||
LowLevelMessages.SendSpherical(buffer, ref ix, this.angularVelocity);
|
LowLevelMessages.SendSpherical(buffer, ref ix, this.angularVelocity);
|
||||||
return ix;
|
return ix;
|
||||||
}
|
}
|
||||||
// public override void Deserialize(byte[] buffer) {
|
|
||||||
// byte ix = 0;
|
|
||||||
// this.networkId = buffer[ix++];
|
|
||||||
// this.thingId = buffer[ix++];
|
|
||||||
// this.poseType = buffer[ix++];
|
|
||||||
|
|
||||||
// if ((poseType & Pose_Position) != 0)
|
|
||||||
// this.position = LowLevelMessages.ReceiveSpherical(buffer, ref ix);
|
|
||||||
// if ((poseType & Pose_Orientation) != 0)
|
|
||||||
// this.orientation = LowLevelMessages.ReceiveSwingTwist(buffer, ref ix);
|
|
||||||
// if ((poseType & Pose_LinearVelocity) != 0)
|
|
||||||
// this.linearVelocity = LowLevelMessages.ReceiveSpherical(buffer, ref ix);
|
|
||||||
// if ((poseType & Pose_AngularVelocity) != 0)
|
|
||||||
// this.angularVelocity = LowLevelMessages.ReceiveSpherical(buffer, ref ix);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public static bool Send(Participant client, byte thingId, Spherical position, SwingTwist orientation) {
|
|
||||||
// PoseMsg msg = new PoseMsg(client.networkId, thingId, position, orientation);
|
|
||||||
// return SendMsg(client, msg);
|
|
||||||
// }
|
|
||||||
// public static async Task<bool> Receive(Stream dataStream, Participant client, byte packetSize) {
|
|
||||||
// byte[] buffer = await Receive(dataStream, packetSize);
|
|
||||||
// PoseMsg msg = new PoseMsg(buffer);
|
|
||||||
|
|
||||||
// // Do no process poses with nwid == 0 (== local)
|
|
||||||
// if (msg.networkId == 0)
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
// client.messageQueue.Enqueue(msg);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public static bool SendTo(Participant participant, Thing thing) {
|
|
||||||
// if (participant == null || thing == null)
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
// byte ix = 0;
|
|
||||||
// participant.buffer[ix++] = PoseMsg.Id;
|
|
||||||
// participant.buffer[ix++] = participant.networkId;
|
|
||||||
// participant.buffer[ix++] = thing.id;
|
|
||||||
// participant.buffer[ix++] = thing.poseUpdated;
|
|
||||||
|
|
||||||
// if ((thing.poseUpdated & Pose_Position) != 0 && thing.position != null)
|
|
||||||
// LowLevelMessages.SendSpherical(participant.buffer, ref ix, thing.position);
|
|
||||||
// if ((thing.poseUpdated & Pose_Orientation) != 0 && thing.orientation != null)
|
|
||||||
// LowLevelMessages.SendQuat32(participant.buffer, ref ix, thing.orientation);
|
|
||||||
// if ((thing.poseUpdated & Pose_LinearVelocity) != 0 && thing.linearVelocity != null)
|
|
||||||
// LowLevelMessages.SendSpherical(participant.buffer, ref ix, thing.linearVelocity);
|
|
||||||
// if ((thing.poseUpdated & Pose_AngularVelocity) != 0 && thing.angularVelocity != null)
|
|
||||||
// LowLevelMessages.SendSpherical(participant.buffer, ref ix, thing.angularVelocity);
|
|
||||||
|
|
||||||
// return participant.SendBuffer(ix);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,10 +1,7 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Passer.RoboidControl {
|
namespace Passer.RoboidControl {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Message for sending generic text.
|
/// Message for sending generic text
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TextMsg : IMessage {
|
public class TextMsg : IMessage {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -43,19 +40,6 @@ namespace Passer.RoboidControl {
|
|||||||
buffer[ix++] = (byte)this.text[textIx];
|
buffer[ix++] = (byte)this.text[textIx];
|
||||||
return ix;
|
return ix;
|
||||||
}
|
}
|
||||||
// public override void Deserialize(byte[] buffer) {
|
|
||||||
// uint ix = 0;
|
|
||||||
// uint strlen = buffer[ix++];
|
|
||||||
// this.text = System.Text.Encoding.UTF8.GetString(buffer, (int)ix, (int)strlen);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public static async Task<bool> Receive(Stream dataStream, Participant client, byte packetSize) {
|
|
||||||
// byte[] buffer = await Receive(dataStream, packetSize);
|
|
||||||
// TextMsg msg = new TextMsg(buffer);
|
|
||||||
|
|
||||||
// client.messageQueue.Enqueue(msg);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||||||
namespace Passer.RoboidControl {
|
namespace Passer.RoboidControl {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A reference to a participant, possible on a remote location
|
/// A reference to a participant, possibly on a remote location
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class RemoteParticipant {
|
public class RemoteParticipant {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -28,7 +28,7 @@ namespace Passer.RoboidControl {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new remote participant
|
/// Create a new remote participant
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ipAddress">The ip address of the participant</param>
|
/// <param name="ipAddress">The IP address of the participant</param>
|
||||||
/// <param name="port">The UDP port of the participant</param>
|
/// <param name="port">The UDP port of the participant</param>
|
||||||
public RemoteParticipant(string ipAddress, int port) {
|
public RemoteParticipant(string ipAddress, int port) {
|
||||||
this.ipAddress = ipAddress;
|
this.ipAddress = ipAddress;
|
||||||
@ -43,7 +43,7 @@ namespace Passer.RoboidControl {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a thing with the given ids
|
/// Get a thing with the given ids
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="networkId">The networkId of the thing</param>
|
/// <param name="networkId">The network ID of the thing</param>
|
||||||
/// <param name="thingId">The ID of the thing</param>
|
/// <param name="thingId">The ID of the thing</param>
|
||||||
/// <returns>The thing when it is found, null in other cases.</returns>
|
/// <returns>The thing when it is found, null in other cases.</returns>
|
||||||
public Thing Get(byte networkId, byte thingId) {
|
public Thing Get(byte networkId, byte thingId) {
|
||||||
|
46
Thing.cs
46
Thing.cs
@ -12,6 +12,28 @@ namespace Passer.RoboidControl {
|
|||||||
|
|
||||||
#region Types
|
#region Types
|
||||||
|
|
||||||
|
#endregion Types
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public delegate void ChangeHandler();
|
||||||
|
public delegate void SphericalHandler(Spherical v);
|
||||||
|
public delegate void ThingHandler(Thing t);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The participant to which this thing belongs
|
||||||
|
/// </summary>
|
||||||
|
public RemoteParticipant participant;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The network ID of this thing.
|
||||||
|
/// </summary>
|
||||||
|
public byte networkId;
|
||||||
|
/// <summary>
|
||||||
|
/// The ID of this thing
|
||||||
|
/// </summary>
|
||||||
|
public byte id;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Predefined thing types
|
/// Predefined thing types
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -37,27 +59,6 @@ namespace Passer.RoboidControl {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public byte type;
|
public byte type;
|
||||||
|
|
||||||
#endregion Types
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The participant to which this thing belongs
|
|
||||||
/// </summary>
|
|
||||||
public RemoteParticipant participant;
|
|
||||||
|
|
||||||
public delegate void ChangeHandler();
|
|
||||||
public delegate void SphericalHandler(Spherical v);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The network ID of this thing.
|
|
||||||
/// </summary>
|
|
||||||
public byte networkId;
|
|
||||||
/// <summary>
|
|
||||||
/// The ID of this thing
|
|
||||||
/// </summary>
|
|
||||||
public byte id;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event which is triggered when the parent changes
|
/// Event which is triggered when the parent changes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -96,7 +97,7 @@ namespace Passer.RoboidControl {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove the given thing as a child of this thing
|
/// Remove the given thing as a child of this thing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="child"></param>
|
/// <param name="child">The child to remove</param>
|
||||||
public void RemoveChild(Thing child) {
|
public void RemoveChild(Thing child) {
|
||||||
children.Remove(child);
|
children.Remove(child);
|
||||||
}
|
}
|
||||||
@ -271,7 +272,6 @@ namespace Passer.RoboidControl {
|
|||||||
|
|
||||||
#endregion Update
|
#endregion Update
|
||||||
|
|
||||||
public delegate void ThingHandler(Thing t);
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event triggered when a new thing has been created
|
/// Event triggered when a new thing has been created
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user