Aligned Messages

This commit is contained in:
Pascal Serrarens 2025-05-01 11:01:40 +02:00
parent b262aa1051
commit 794b1ca80e
16 changed files with 544 additions and 216 deletions

View File

@ -1,6 +1,6 @@
warning: source 'images' is not a readable file or directory... skipping. warning: source 'images' is not a readable file or directory... skipping.
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:62: warning: @copybrief or @copydoc target 'Thing::Update' not found d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:77: warning: @copybrief or @copydoc target 'Thing::Update' not found
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:46: warning: Found unknown command '@params' d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:61: warning: Found unknown command '@params'
d:/Python/RoboidControl/RoboidControl/LinearAlgebra/build/lib/LinearAlgebra/Direction.py:47: warning: Member FromVector3(Vector3 v) (function) of class LinearAlgebra.Direction.Direction is not documented. d:/Python/RoboidControl/RoboidControl/LinearAlgebra/build/lib/LinearAlgebra/Direction.py:47: warning: Member FromVector3(Vector3 v) (function) of class LinearAlgebra.Direction.Direction is not documented.
d:/Python/RoboidControl/RoboidControl/LinearAlgebra/build/lib/LinearAlgebra/Direction.py:100: warning: Member __repr__(self) (function) of class LinearAlgebra.Direction.Direction is not documented. d:/Python/RoboidControl/RoboidControl/LinearAlgebra/build/lib/LinearAlgebra/Direction.py:100: warning: Member __repr__(self) (function) of class LinearAlgebra.Direction.Direction is not documented.
d:/Python/RoboidControl/RoboidControl/LinearAlgebra/LinearAlgebra/Direction.py:47: warning: Member FromVector3(Vector3 v) (function) of class LinearAlgebra.Direction.Direction is not documented. d:/Python/RoboidControl/RoboidControl/LinearAlgebra/LinearAlgebra/Direction.py:47: warning: Member FromVector3(Vector3 v) (function) of class LinearAlgebra.Direction.Direction is not documented.
@ -78,99 +78,131 @@ d:/Python/RoboidControl/RoboidControl/LinearAlgebra/LinearAlgebra/SwingTwist.py:
d:/Python/RoboidControl/RoboidControl/LinearAlgebra/LinearAlgebra/SwingTwist.py:29: warning: Member Radians(float horizontal, float vertical, float twist) (function) of class LinearAlgebra.SwingTwist.SwingTwist is not documented. d:/Python/RoboidControl/RoboidControl/LinearAlgebra/LinearAlgebra/SwingTwist.py:29: warning: Member Radians(float horizontal, float vertical, float twist) (function) of class LinearAlgebra.SwingTwist.SwingTwist is not documented.
d:/Python/RoboidControl/RoboidControl/LinearAlgebra/LinearAlgebra/SwingTwist.py:54: warning: Member FromQuaternion(Quaternion q) (function) of class LinearAlgebra.SwingTwist.SwingTwist is not documented. d:/Python/RoboidControl/RoboidControl/LinearAlgebra/LinearAlgebra/SwingTwist.py:54: warning: Member FromQuaternion(Quaternion q) (function) of class LinearAlgebra.SwingTwist.SwingTwist is not documented.
d:/Python/RoboidControl/RoboidControl/LinearAlgebra/LinearAlgebra/SwingTwist.py:90: warning: Member Angle(r1, r2) (function) of class LinearAlgebra.SwingTwist.SwingTwist is not documented. d:/Python/RoboidControl/RoboidControl/LinearAlgebra/LinearAlgebra/SwingTwist.py:90: warning: Member Angle(r1, r2) (function) of class LinearAlgebra.SwingTwist.SwingTwist is not documented.
d:/Python/RoboidControl/RoboidControl/Messages/NetworkIdMsg.py:14: warning: Member network_id (variable) of class RoboidControl.Messages.NetworkIdMsg.NetworkIdMsg is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:92: warning: Member GetParticipant(self, str ip_address, int port) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/Messages/NetworkIdMsg.py:7: warning: Member id (variable) of class RoboidControl.Messages.NetworkIdMsg.NetworkIdMsg is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:102: warning: Member AddParticipant(self, str ip_address, int port) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/Messages/NetworkIdMsg.py:8: warning: Member length (variable) of class RoboidControl.Messages.NetworkIdMsg.NetworkIdMsg is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:128: warning: Member UpdateMyThings(self, int currentTimeMs) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/Messages/ParticipantMsg.py:19: warning: Member network_id (variable) of class RoboidControl.Messages.ParticipantMsg.ParticipantMsg is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:157: warning: Member SendThingInfo(self, Participant owner, 'Thing' thing, bool recursively=False) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/Participant.py:58: warning: argument 'The' of command @param is not found in the argument list of Participant::Update(self, currentTimeMs=0) d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:168: warning: Member PublishThingInfo(self, Thing thing) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/Participant.py:58: warning: The following parameter of RoboidControl.Participant.Participant.Update(self, currentTimeMs=0) is not documented: d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:175: warning: Member Send(self, Participant owner, IMessage msg) (function) of class ParticipantUDP.ParticipantUDP is not documented.
parameter 'currentTimeMs' d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:184: warning: Member Publish(self, IMessage msg) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:68: warning: Member Isolated() (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:197: warning: Member Receiver(self) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:75: warning: Member GetParticipant(self, ip_address, port) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:213: warning: Member ReceiveData(self, bytes data, Participant sender) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:85: warning: Member AddParticipant(self, ip_address, port) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:234: warning: Member ProcessParticipantMsg(self, Participant sender, ParticipantMsg msg) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:107: warning: Member UpdateMyThings(self, currentTimeMs) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:237: warning: Member ProcessSiteIdMsg(self, Participant sender, NetworkIdMsg msg) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:136: warning: Member SendThingInfo(self, owner, thing, bool recursively=False) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:245: warning: Member ProcessInvestigateMsg(self, Participant sender, InvestigateMsg msg) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:148: warning: Member Send(self, owner, msg) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:248: warning: Member ProcessThingMsg(self, ThingMsg msg) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:157: warning: Member Publish(self, msg) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:251: warning: Member ProcessNameMsg(self, NameMsg msg) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:170: warning: Member Receiver(self) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:254: warning: Member ProcessModelUrlMsg(self, ModelUrlMsg msg) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:186: warning: Member ReceiveData(self, data, sender) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:257: warning: Member ProcessPoseMsg(self, Participant sender, PoseMsg msg) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:205: warning: Member ProcessParticipantMsg(self, sender, ParticipantMsg msg) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:277: warning: Member ProcessBinaryMsg(self, BinaryMsg msg) (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:208: warning: Member ProcessSiteIdMsg(self, sender, NetworkIdMsg msg) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:83: warning: Member Isolated() (function) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:216: warning: Member ProcessInvestigateMsg(self, bytearray data) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:67: warning: Member is_isolated (variable) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:219: warning: Member ProcessThingMsg(self, ThingMsg msg) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:69: warning: Member remote_site (variable) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:222: warning: Member ProcessNameMsg(self, NameMsg msg) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:74: warning: Member udp_socket (variable) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:225: warning: Member ProcessModelUrlMsg(self, ModelUrlMsg msg) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:76: warning: Member port (variable) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:228: warning: Member ProcessBinaryMsg(self, BinaryMsg msg) (function) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:78: warning: Member thread (variable) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:46: warning: Member remote_site (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:122: warning: Member nextPublishMe (variable) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:58: warning: Member publishInterval (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:139: warning: Member network_id (variable) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:60: warning: Member udp_socket (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:42: warning: Member name (variable) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:62: warning: Member port (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:90: warning: Member isolated_participant (variable) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:103: warning: Member nextPublishMe (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:126: warning: Member nextPublishMe (variable) of class ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:119: warning: Member network_id (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:51: warning: argument 'ipAddress' of command @param is not found in the argument list of ParticipantUDP::__init__(self, int port=7681, Optional[str] ip_address=None, int local_port=7681)
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:29: warning: Member buffer (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:51: warning: argument 'localPort' of command @param is not found in the argument list of ParticipantUDP::__init__(self, int port=7681, Optional[str] ip_address=None, int local_port=7681)
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:30: warning: Member nextPublishMe (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:51: warning: The following parameters of ParticipantUDP.ParticipantUDP.__init__(self, int port=7681, Optional[str] ip_address=None, int local_port=7681) are not documented:
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:32: warning: Member thread (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented. parameter 'ip_address'
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:33: warning: Member name (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:34: warning: Member isolated_participant (variable) of class RoboidControl.ParticipantUDP.ParticipantUDP is not documented.
d:/Python/RoboidControl/RoboidControl/Participant.py:11: warning: The following parameter of RoboidControl.ParticipantUDP.ParticipantUDP.__init__(self, ip_address=7681, port=None, local_port=7681) is not documented:
parameter 'local_port' parameter 'local_port'
d:/Python/RoboidControl/RoboidControl/ParticipantUDP.py:91: warning: argument 'The' of command @param is not found in the argument list of ParticipantUDP::Update(self, currentTimeMs=None) inherited from member Update at line 58 in file d:/Python/RoboidControl/RoboidControl/Participant.py d:/Python/RoboidControl/RoboidControl/Participants/ParticipantUDP.py:110: warning: argument 'The' of command @param is not found in the argument list of ParticipantUDP::Update(self, Optional[int] currentTimeMs=None) inherited from member Update at line 62 in file d:/Python/RoboidControl/RoboidControl/Participant.py
d:/Python/RoboidControl/RoboidControl/Participant.py:58: warning: The following parameter of RoboidControl.ParticipantUDP.ParticipantUDP.Update(self, currentTimeMs=None) is not documented: d:/Python/RoboidControl/RoboidControl/Participant.py:62: warning: The following parameter of ParticipantUDP.ParticipantUDP.Update(self, Optional[int] currentTimeMs=None) is not documented:
parameter 'currentTimeMs' parameter 'currentTimeMs'
d:/Python/RoboidControl/RoboidControl/Thing.py:113: warning: Member Update(self, currentTime, recurse=False) (function) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Messages/DestroyMsg.py:23: warning: Member thing_id (variable) of class RoboidControl.Messages.DestroyMsg.DestroyMsg is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:125: warning: Member SetParent(self, parent) (function) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Messages/DestroyMsg.py:40: warning: Member network_id (variable) of class RoboidControl.Messages.DestroyMsg.DestroyMsg is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:134: warning: Member AddChild(self, child) (function) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Messages/DestroyMsg.py:10: warning: Member id (variable) of class RoboidControl.Messages.DestroyMsg.DestroyMsg is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:141: warning: Member RemoveChild(self, child) (function) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Messages/DestroyMsg.py:11: warning: Member length (variable) of class RoboidControl.Messages.DestroyMsg.DestroyMsg is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:144: warning: Member GenerateBinary(self, buffer, ix_ref) (function) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Messages/NetworkIdMsg.py:17: warning: Member network_id (variable) of class RoboidControl.Messages.NetworkIdMsg.NetworkIdMsg is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:147: warning: Member ProcessBinary(self, data) (function) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Messages/NetworkIdMsg.py:9: warning: Member id (variable) of class RoboidControl.Messages.NetworkIdMsg.NetworkIdMsg is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:58: warning: Member children (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Messages/NetworkIdMsg.py:10: warning: Member length (variable) of class RoboidControl.Messages.NetworkIdMsg.NetworkIdMsg is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:85: warning: Member position (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Messages/ParticipantMsg.py:19: warning: Member network_id (variable) of class RoboidControl.Messages.ParticipantMsg.ParticipantMsg is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:86: warning: Member position_updated (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Participant.py:84: warning: Member AddParticipant(Union[str, int] arg1, Optional[int] port) (function) of class RoboidControl.Participant.Participant is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:92: warning: Member orientation (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Participant.py:70: warning: Member GetParticipant(Union[str, int] arg1, Optional[int] port) (function) of class RoboidControl.Participant.Participant is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:93: warning: Member orientation_updated (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Participant.py:64: warning: Member things (variable) of class RoboidControl.Participant.Participant is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:100: warning: Member linear_velocity_updated (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Participant.py:67: warning: Member participants (variable) of class RoboidControl.Participant.Participant is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:102: warning: Member linear_velocity (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Participant.py:62: warning: argument 'The' of command @param is not found in the argument list of Participant::Update(self, int currentTimeMs=0)
d:/Python/RoboidControl/RoboidControl/Thing.py:109: warning: Member angular_velocity_updated (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Participant.py:62: warning: The following parameter of RoboidControl.Participant.Participant.Update(self, int currentTimeMs=0) is not documented:
d:/Python/RoboidControl/RoboidControl/Thing.py:111: warning: Member angular_velocity (variable) of class RoboidControl.Thing.Thing is not documented. parameter 'currentTimeMs'
d:/Python/RoboidControl/RoboidControl/Thing.py:28: warning: Member Position (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:57: warning: Member owner (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:29: warning: Member Orientation (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:109: warning: Member parent (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:30: warning: Member LinearVelocity (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:168: warning: Member position (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:31: warning: Member AngularVelocity (variable) of class RoboidControl.Thing.Thing is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:169: warning: Member position_updated (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:35: warning: argument 'thingId' of command @param is not found in the argument list of Thing::__init__(self, owner=None, parent=None, thing_type=Type.Undetermined, thing_id=0) d:/Python/RoboidControl/RoboidControl/Thing.py:175: warning: Member orientation (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:35: warning: The following parameter of RoboidControl.Thing.Thing.__init__(self, owner=None, parent=None, thing_type=Type.Undetermined, thing_id=0) is not documented: d:/Python/RoboidControl/RoboidControl/Thing.py:176: warning: Member orientation_updated (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:183: warning: Member linear_velocity_updated (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:185: warning: Member linear_velocity (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:192: warning: Member angular_velocity_updated (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:194: warning: Member angular_velocity (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:31: warning: Member Position (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:32: warning: Member Orientation (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:33: warning: Member LinearVelocity (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:34: warning: Member AngularVelocity (variable) of class RoboidControl.Thing.Thing is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:40: warning: argument 'thingId' of command @param is not found in the argument list of Thing::__init__(self, Optional[ 'Participant'] owner=None, Optional[ 'Thing'] parent=None, int thing_type=Type.Undetermined, int thing_id=0)
d:/Python/RoboidControl/RoboidControl/Thing.py:40: warning: The following parameter of RoboidControl.Thing.Thing.__init__(self, Optional[ 'Participant'] owner=None, Optional[ 'Thing'] parent=None, int thing_type=Type.Undetermined, int thing_id=0) is not documented:
parameter 'thing_id' parameter 'thing_id'
d:/Python/RoboidControl/RoboidControl/Thing.py:97: warning: argument 'linearVelocity' of command @param is not found in the argument list of Thing::SetLinearVelocity(self, linear_velocity) d:/Python/RoboidControl/RoboidControl/Thing.py:102: warning: argument 'The' of command @param is not found in the argument list of Thing::SetParent(self, Optional[ 'Thing'] parent)
d:/Python/RoboidControl/RoboidControl/Thing.py:97: warning: The following parameter of RoboidControl.Thing.Thing.SetLinearVelocity(self, linear_velocity) is not documented: d:/Python/RoboidControl/RoboidControl/Thing.py:102: warning: The following parameter of RoboidControl.Thing.Thing.SetParent(self, Optional[ 'Thing'] parent) is not documented:
parameter 'parent'
d:/Python/RoboidControl/RoboidControl/Thing.py:133: warning: argument 'id' of command @param is not found in the argument list of Thing::GetChild(self, int thing_id, bool recurse=False)
d:/Python/RoboidControl/RoboidControl/Thing.py:133: warning: The following parameter of RoboidControl.Thing.Thing.GetChild(self, int thing_id, bool recurse=False) is not documented:
parameter 'thing_id'
d:/Python/RoboidControl/RoboidControl/Thing.py:180: warning: argument 'linearVelocity' of command @param is not found in the argument list of Thing::SetLinearVelocity(self, Spherical linear_velocity)
d:/Python/RoboidControl/RoboidControl/Thing.py:180: warning: The following parameter of RoboidControl.Thing.Thing.SetLinearVelocity(self, Spherical linear_velocity) is not documented:
parameter 'linear_velocity' parameter 'linear_velocity'
d:/Python/RoboidControl/RoboidControl/Thing.py:106: warning: argument 'angularVelocity' of command @param is not found in the argument list of Thing::SetAngularVelocity(self, angular_velocity) d:/Python/RoboidControl/RoboidControl/Thing.py:189: warning: argument 'angularVelocity' of command @param is not found in the argument list of Thing::SetAngularVelocity(self, Spherical angular_velocity)
d:/Python/RoboidControl/RoboidControl/Thing.py:106: warning: The following parameter of RoboidControl.Thing.Thing.SetAngularVelocity(self, angular_velocity) is not documented: d:/Python/RoboidControl/RoboidControl/Thing.py:189: warning: The following parameter of RoboidControl.Thing.Thing.SetAngularVelocity(self, Spherical angular_velocity) is not documented:
parameter 'angular_velocity' parameter 'angular_velocity'
d:/Python/RoboidControl/RoboidControl/Thing.py:11: warning: Member Undetermined (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:225: warning: argument 'buffer' of command @param is not found in the argument list of Thing::GenerateBinary(self, bytearray bytes, set[int] ix_ref)
d:/Python/RoboidControl/RoboidControl/Thing.py:13: warning: Member Switch (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:225: warning: The following parameter of RoboidControl.Thing.Thing.GenerateBinary(self, bytearray bytes, set[int] ix_ref) is not documented:
d:/Python/RoboidControl/RoboidControl/Thing.py:14: warning: Member DistanceSensor (variable) of class RoboidControl.Thing.Thing.Type is not documented. parameter 'bytes'
d:/Python/RoboidControl/RoboidControl/Thing.py:15: warning: Member DirectionalSensor (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:233: warning: argument 'bytes' of command @param is not found in the argument list of Thing::ProcessBinary(self, bytes data)
d:/Python/RoboidControl/RoboidControl/Thing.py:16: warning: Member TemperatureSensor (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:233: warning: The following parameter of RoboidControl.Thing.Thing.ProcessBinary(self, bytes data) is not documented:
d:/Python/RoboidControl/RoboidControl/Thing.py:17: warning: Member TouchSensor (variable) of class RoboidControl.Thing.Thing.Type is not documented. parameter 'data'
d:/Python/RoboidControl/RoboidControl/Thing.py:19: warning: Member ControlledMotor (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:13: warning: Member Undetermined (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:20: warning: Member UncontrolledMotor (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:15: warning: Member Switch (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:21: warning: Member Servo (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:16: warning: Member DistanceSensor (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:23: warning: Member Roboid (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:17: warning: Member DirectionalSensor (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:24: warning: Member Humanoid (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:18: warning: Member TemperatureSensor (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:25: warning: Member ExternalSensor (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:19: warning: Member TouchSensor (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Thing.py:26: warning: Member Animator (variable) of class RoboidControl.Thing.Thing.Type is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:21: warning: Member ControlledMotor (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:22: warning: Member SetDriveDimensions(self, wheel_diameter, wheel_separation) (function) of class RoboidControl.Things.DifferentialDrive.DifferentialDrive is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:22: warning: Member UncontrolledMotor (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:33: warning: Member SetMotors(self, wheel_left, wheel_right) (function) of class RoboidControl.Things.DifferentialDrive.DifferentialDrive is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:23: warning: Member Servo (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:46: warning: Found unknown command '@params' d:/Python/RoboidControl/RoboidControl/Thing.py:25: warning: Member Roboid (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:62: warning: @copybrief or @copydoc target 'Thing::Update' not found d:/Python/RoboidControl/RoboidControl/Thing.py:26: warning: Member Humanoid (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:31: warning: Member wheel_left (variable) of class RoboidControl.Things.DifferentialDrive.DifferentialDrive is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:27: warning: Member ExternalSensor (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:31: warning: Member wheel_right (variable) of class RoboidControl.Things.DifferentialDrive.DifferentialDrive is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:28: warning: Member Animator (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:64: warning: Member angular_velocity_updated (variable) of class RoboidControl.Things.DifferentialDrive.DifferentialDrive is not documented. d:/Python/RoboidControl/RoboidControl/Thing.py:29: warning: Member DifferentialDrive (variable) of class RoboidControl.Thing.Thing.Type is not documented.
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:46: warning: Found unknown command '@params' d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:76: warning: unable to resolve link to 'https://en.wikipedia.org/wiki/Differential_wheeled_robot' for \link command
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:47: warning: Found unknown command '@params' d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:61: warning: Found unknown command '@params'
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:62: warning: @copybrief or @copydoc target 'Thing::Update' not found d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:77: warning: @copybrief or @copydoc target 'Thing::Update' not found
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:63: warning: @copydetails or @copydoc target 'Thing::Update' not found d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:42: warning: Member wheel_left (variable) of class RoboidControl.Things.DifferentialDrive.DifferentialDrive is not documented.
d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:24: warning: Member ProcessParticipantMsg(self, sender, msg) (function) of class SiteServer.SiteServer is not documented. d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:42: warning: Member wheel_right (variable) of class RoboidControl.Things.DifferentialDrive.DifferentialDrive is not documented.
d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:29: warning: Member ProcessNetworkId(self, msg) (function) of class SiteServer.SiteServer is not documented. d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:79: warning: Member angular_velocity_updated (variable) of class RoboidControl.Things.DifferentialDrive.DifferentialDrive is not documented.
d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:21: warning: Member isolated (variable) of class SiteServer.SiteServer is not documented. d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:27: warning: argument 'wheelDiameter' of command @param is not found in the argument list of DifferentialDrive::SetDriveDimensions(self, wheel_diameter, wheel_separation)
d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:22: warning: Member publishInterval (variable) of class SiteServer.SiteServer is not documented. d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:27: warning: argument 'wheelSeparation' of command @param is not found in the argument list of DifferentialDrive::SetDriveDimensions(self, wheel_diameter, wheel_separation)
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:27: warning: The following parameters of RoboidControl.Things.DifferentialDrive.DifferentialDrive.SetDriveDimensions(self, wheel_diameter, wheel_separation) are not documented:
parameter 'wheel_diameter'
parameter 'wheel_separation'
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:46: warning: argument 'leftWheel' of command @param is not found in the argument list of DifferentialDrive::SetMotors(self, wheel_left, wheel_right)
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:46: warning: argument 'rightWheel' of command @param is not found in the argument list of DifferentialDrive::SetMotors(self, wheel_left, wheel_right)
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:46: warning: The following parameters of RoboidControl.Things.DifferentialDrive.DifferentialDrive.SetMotors(self, wheel_left, wheel_right) are not documented:
parameter 'wheel_left'
parameter 'wheel_right'
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:61: warning: Found unknown command '@params'
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:62: warning: Found unknown command '@params'
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:77: warning: @copybrief or @copydoc target 'Thing::Update' not found
d:/Python/RoboidControl/RoboidControl/Things/DifferentialDrive.py:78: warning: @copydetails or @copydoc target 'Thing::Update' not found
d:/Python/RoboidControl/RoboidControl/Things/TemperatureSensor.py:7: warning: argument 'thingId' of command @param is not found in the argument list of TemperatureSensor::__init__(self, owner=None, parent=None, thing_type=0) inherited from member __init__ at line 40 in file d:/Python/RoboidControl/RoboidControl/Thing.py
d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:33: warning: Member ProcessParticipantMsg(self, sender, msg) (function) of class SiteServer.SiteServer is not documented.
d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:38: warning: Member ProcessNetworkIdMsg(self, sender, msg) (function) of class SiteServer.SiteServer is not documented.
d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:41: warning: Member ProcessThingMsg(self, sender, ThingMsg msg) (function) of class SiteServer.SiteServer is not documented.
d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:23: warning: Member isolated (variable) of class SiteServer.SiteServer is not documented.
d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:24: warning: Member publishInterval (variable) of class SiteServer.SiteServer is not documented.
d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:14: warning: Member name (variable) of class SiteServer.SiteServer is not documented. d:/Python/RoboidControl/RoboidControl/Participants/SiteServer.py:14: warning: Member name (variable) of class SiteServer.SiteServer is not documented.
d:/Python/RoboidControl/README.md:13: warning: unable to resolve reference to 'RoboidControl::ParticipantUDP::ParticipantUDP' for \ref command

View File

@ -2,30 +2,55 @@ from RoboidControl.Thing import Thing
from RoboidControl.Messages.IMessage import IMessage from RoboidControl.Messages.IMessage import IMessage
from typing import Optional, Union from typing import Optional, Union
import logging
logger = logging.getLogger(__name__)
class BinaryMsg(IMessage): class BinaryMsg(IMessage):
id = 0xB1 """! A message containing binary data for custom communication
length = 4 """
## The message ID
id: int = 0xB1
## The length of the message in bytes, excluding the binary data
#
## For the total size of the message self.data_length should be added to this value.
length: int = 4
def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing] = None): def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing] = None):
"""! Create a BinaryMsg
@param arg1 Either:
- bytes: contianing the serialized data; or
- int: containgint the network_id
@param thing The thing for which the data is communicated
"""
if thing is None: if thing is None:
data = bytes(arg1) data = bytes(arg1)
## The network ID of the thing
self.network_id = data[1]
## The ID of the thing
self.thing_id = data[2] self.thing_id = data[2]
## The length of the data
self.data_length = data[3] self.data_length = data[3]
## The binary data
self.data = data[4:] self.data = data[4:]
else: else:
## The network ID of the thing
self.network_id = int(arg1) self.network_id = int(arg1)
## The ID of the thing
self.thing_id = thing.id self.thing_id = thing.id
## The thing for which the binary data is communicated
self.thing = thing self.thing = thing
def Serialize(self, buffer_ref: list[bytearray]): def Serialize(self, ref_buffer: list[bytearray]):
buffer: bytearray = buffer_ref[0] """!
@copydoc RoboidControl::Messages::IMessage::IMessage::Serialize
"""
buffer: bytearray = ref_buffer[0]
ix = self.length ix = self.length
self.data_length = self.thing.GenerateBinary(buffer, {ix}) self.data_length = self.thing.GenerateBinary(buffer, {ix})
if ix <= self.length: if ix <= self.length:
return 0 return 0
print(f'Send BinaryMsg [{self.network_id}/{self.thing_id}] {self.data_length}') logger.debug(f'Send BinaryMsg [{self.network_id}/{self.thing_id}] {self.data_length}')
buffer[0] = self.id buffer[0] = self.id
buffer[1] = self.network_id buffer[1] = self.network_id

View File

@ -0,0 +1,47 @@
from RoboidControl.Messages.IMessage import IMessage
from RoboidControl.Thing import Thing
from typing import Union, Optional
import logging
logger = logging.getLogger(__name__)
class DestroyMsg(IMessage):
"""! Message notifiying that a Thing no longer exists
"""
## The message ID
id = 0xB1
## The length of the message in bytes
length = 4
def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing] = None):
"""! Create a destroy message
@param arg1 Either
- bytes containing the serialized data; or
- an int containing the network_id
@param thing The thing which is destroyed
"""
if thing is None:
## Create from serialized data
data = bytes(arg1)
self.network_id = data[1]
self.thing_id = data[2]
else:
## Create from the thing details
self.network_id: int = int(arg1)
self.thing_id: int = thing.id
def Serialize(self, ref_buffer: list[bytearray]):
"""!
@copydoc RoboidControl::Messages::IMessage::IMessage::Serialize
"""
logger.debug(f'Send DestroyMsg [{self.network_id}/{self.thing_id}]')
buffer: bytearray = ref_buffer[0]
buffer[0:DestroyMsg.length] = [
DestroyMsg.id,
self.network_id,
self.thing_id
]
return DestroyMsg.length

View File

@ -1,8 +1,14 @@
class IMessage: class IMessage:
id = 0x00 """! Root structure for all communcation messages
"""
## Serialize the message into the given buffer ## Serialize the message into the given buffer
# #
## @returns: the length of the message ## @returns: the length of the message
def Serialize(self, buffer_ref: list[bytearray]) -> int: def Serialize(self, buffer_ref: list[bytearray]) -> int:
"""! Serialize the message into the given buffer
@param ref_buffer Reference to the buffer to serilize into
@return The length of the message in the buffer
"""
return 0 return 0

View File

@ -1,7 +1,47 @@
from RoboidControl.Messages.IMessage import IMessage
from RoboidControl.Thing import Thing
from typing import Union, Optional
import logging
logger = logging.getLogger(__name__)
class InvestigateMsg(): class InvestigateMsg():
"""! Message to request details for a Thing
"""
## The message ID
id = 0x81 id = 0x81
## The length of the message in bytes
length = 3 length = 3
def __init__(self, buffer): def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing] = None):
self.thing_id = buffer[2] """! Create an investigate message
@param arg1 Either
- bytes containing the serialized data; or
- an int containing the network_id
@param thing The thing for which the details are requested
"""
if thing is None:
## Create from serialized data
data = bytes(arg1)
self.network_id: int = data[1]
self.thing_id: int = data[2]
else:
## Create from thing details
self.network_id: int = int(arg1)
self.thing_id: int = thing.id
def Serialize(self, ref_buffer: list[bytearray]):
"""!
@copydoc RoboidControl::Messages::IMessage::IMessage::Serialize
"""
logger.debug(f'Send DestroyMsg [{self.network_id}/{self.thing_id}]')
buffer: bytearray = ref_buffer[0]
buffer[0:InvestigateMsg.length] = [
InvestigateMsg.id,
self.network_id,
self.thing_id
]
return InvestigateMsg.length

View File

@ -4,49 +4,12 @@ from LinearAlgebra.Spherical import Spherical
from LinearAlgebra.Quaternion import Quaternion from LinearAlgebra.Quaternion import Quaternion
from LinearAlgebra.Angle import Angle from LinearAlgebra.Angle import Angle
def SendAngle8(buffer, ref_ix, angle):
"""! Send an 8-bit angle value """
# angle = Angle.Normalize(angle)
ix = ref_ix[0]
buffer[ix] = int((angle.InDegrees() / 360) * 256).to_bytes(1, 'big', signed=True)[0]
ref_ix[0] += 1
def ReceiveAngle8(buffer: bytes, ref_ix: list[int]) -> Angle:
angle: Angle = Angle()
angle.value = buffer[ref_ix[0]]
ref_ix[0] += 1
return angle
def SendFloat16(buffer, ix_ref, value):
"""! Send a 16-bit floating point value """
ix = ix_ref[0]
value16 = np.float16(value)
binary = value16.view(np.uint16)
buffer[ix:ix+2] = [
(binary & 0xFF00) >> 8,
(binary & 0x00FF)
]
ix_ref[0] += 2
def ReceiveFloat16(buffer, ix_ref) -> float:
"""! Receive a 16-bit floating point value """
ix = ix_ref[0]
# if ix < len(buffer) - 1:
binary = (buffer[ix] << 8) + buffer[ix+1]
# else:
# binary = 0
value16 = np.uint16(binary).view(np.float16)
ix_ref[0] += 2
return float(value16)
def SendSpherical(buffer, ix_ref, vector): def SendSpherical(buffer, ix_ref, vector):
"""! Send a spherical vector """! Send a spherical vector
""" """
SendFloat16(buffer, ix_ref, vector.distance) SendFloat16(buffer, ix_ref, vector.distance)
SendAngle8(buffer, ix_ref, vector.direction.horizontal) SendAngle8(buffer, ix_ref, vector.direction.horizontal)
SendAngle8(buffer, ix_ref, vector.direction.vertical) SendAngle8(buffer, ix_ref, vector.direction.vertical)
def ReceiveSpherical(buffer: bytes, ref_ix: list[int]) -> Spherical: def ReceiveSpherical(buffer: bytes, ref_ix: list[int]) -> Spherical:
"""! Receive a spherical vector """! Receive a spherical vector
""" """
@ -78,7 +41,6 @@ def SendQuat32(buffer, ref_ix, q):
qw qw
] ]
ref_ix[0] += 4 ref_ix[0] += 4
def ReceiveQuaternion(buffer: bytes, ref_ix: list[int]): def ReceiveQuaternion(buffer: bytes, ref_ix: list[int]):
qx: float = (buffer[ref_ix[0]] - 128) / 127 qx: float = (buffer[ref_ix[0]] - 128) / 127
ref_ix[0] += 1 ref_ix[0] += 1
@ -90,3 +52,37 @@ def ReceiveQuaternion(buffer: bytes, ref_ix: list[int]):
ref_ix[0] += 1 ref_ix[0] += 1
q: Quaternion = Quaternion(qx, qy, qz, qw) q: Quaternion = Quaternion(qx, qy, qz, qw)
return q return q
def SendAngle8(buffer, ref_ix, angle):
"""! Send an 8-bit angle value """
# angle = Angle.Normalize(angle)
ix = ref_ix[0]
buffer[ix] = int((angle.InDegrees() / 360) * 256).to_bytes(1, 'big', signed=True)[0]
ref_ix[0] += 1
def ReceiveAngle8(buffer: bytes, ref_ix: list[int]) -> Angle:
angle: Angle = Angle()
angle.value = buffer[ref_ix[0]]
ref_ix[0] += 1
return angle
def SendFloat16(buffer, ix_ref, value):
"""! Send a 16-bit floating point value """
ix = ix_ref[0]
value16 = np.float16(value)
binary = value16.view(np.uint16)
buffer[ix:ix+2] = [
(binary & 0xFF00) >> 8,
(binary & 0x00FF)
]
ix_ref[0] += 2
def ReceiveFloat16(buffer, ix_ref) -> float:
"""! Receive a 16-bit floating point value """
ix = ix_ref[0]
# if ix < len(buffer) - 1:
binary = (buffer[ix] << 8) + buffer[ix+1]
# else:
# binary = 0
value16 = np.uint16(binary).view(np.float16)
ix_ref[0] += 2
return float(value16)

View File

@ -1,42 +1,71 @@
from RoboidControl.Messages.IMessage import IMessage
from RoboidControl.Thing import Thing from RoboidControl.Thing import Thing
from RoboidControl.Messages.IMessage import IMessage
from typing import Union, Optional from typing import Optional, Union
import logging
logger = logging.getLogger(__name__)
class ModelUrlMsg(IMessage): class ModelUrlMsg(IMessage):
"""! Message for communicating the URL for a model of the thing
"""
## The message ID
id = 0x90 id = 0x90
## The length of the message in bytes, excluding the binary data
#
## For the total size of the message self.url_length should be added to this value.
length = 4 length = 4
def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing] = None): def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing] = None):
"""! Create a ModelUrlMsg
@param arg1 Either:
- bytes: containing the serialized data; or
- int: containing the network_id
@param thing The thing for which the data is communicated
"""
if thing is None: if thing is None:
data = bytes(arg1) data = bytes(arg1)
## The network ID of the thing
self.network_id = data[1]
## The ID of the thing
self.thing_id = data[2] self.thing_id = data[2]
# model url length is not needed here ## The url
self.url = data[ModelUrlMsg.length:].decode("utf-8") self.url = data[ModelUrlMsg.length:]
## The length of the encoded url
self.url_length = len(self.url)
self.url = self.url.decode("utf-8")
else: else:
## The network ID of the thing
self.network_id: int = int(arg1) self.network_id: int = int(arg1)
## The ID of the thing
self.thing_id: int = thing.id self.thing_id: int = thing.id
self.url: Optional[str] = thing.model_url ## The URL
self.url: Optional[str] = thing.model_url.encode('utf-8')
## The length of the encoded URL
self.url_length = len(self.url)
def Serialize(self, buffer_ref: list[bytearray]): def Serialize(self, buffer_ref: list[bytearray]):
"""!
@copydoc RoboidControl::Messages::IMessage::IMessage::Serialize
"""
if self.url is None: if self.url is None:
return 0 return 0
buffer: bytearray = buffer_ref[0] buffer: bytearray = buffer_ref[0]
encoded_url = self.url.encode('utf-8') full_length = ModelUrlMsg.length + self.url_length
url_length = len(encoded_url) if self.url_length == 0 or full_length > len(buffer):
full_length = ModelUrlMsg.length + url_length
if url_length == 0 or full_length > len(buffer):
return 0 return 0
logger.debug(f'Send ModelUrlMsg [{self.network_id}/{self.thing_id}] {self.url_length}')
buffer[0:ModelUrlMsg.length] = [ buffer[0:ModelUrlMsg.length] = [
ModelUrlMsg.id, ModelUrlMsg.id,
0, # network_id, self.network_id,
self.thing_id, self.thing_id,
url_length self.url_length
] ]
# Append the url string # Append the url string
buffer[ModelUrlMsg.length:full_length] = encoded_url buffer[ModelUrlMsg.length:full_length] = self.url
return full_length return full_length

View File

@ -1,24 +1,49 @@
from RoboidControl.Messages.IMessage import IMessage from RoboidControl.Messages.IMessage import IMessage
from RoboidControl.Thing import Thing from RoboidControl.Thing import Thing
from typing import Union, Optional from typing import Optional, Union
import logging
logger = logging.getLogger(__name__)
class NameMsg(IMessage): class NameMsg(IMessage):
id = 0x91 id = 0x91
length = 4 length = 4
def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing] = None): def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing] = None):
"""! Create a NameMsg
@param arg1 Either:
- bytes: contianing the serialized data; or
- int: containgint the network_id
@param thing The thing for which the data is communicated
"""
if thing is None: if thing is None:
data = bytes(arg1) data = bytes(arg1)
self.thing_id = data[2] ## The network ID of the thing
# name_length is not needed here self.network_id: int = data[1]
self.name = data[NameMsg.length:].decode("utf-8") ## The ID of the thing
self.thing_id: int = data[2]
## The name
self.name: str = data[NameMsg.length:]
## The length of the encoded name
self.name_length: int = len(self.name)
self.name = self.name.decode("utf-8")
else: else:
## The network ID of the thing
self.network_id: int = int(arg1) self.network_id: int = int(arg1)
## The ID of the thing
self.thing_id: int = thing.id self.thing_id: int = thing.id
self.name: Optional[str] = thing.name ## The name
if thing.name is None:
self.name: Optional[str] = None
else:
self.name: Optional[str] = thing.name.encode('utf-8')
## The length of the encoded name
self.name_length = len(self.name)
def Serialize(self, buffer_ref: list[bytearray]): def Serialize(self, buffer_ref: list[bytearray]):
"""!
@copydoc RoboidControl::Messages::IMessage::IMessage::Serialize
"""
if self.name is None: if self.name is None:
return 0 return 0
@ -30,9 +55,11 @@ class NameMsg(IMessage):
if name_length == 0 or full_length > len(buffer): if name_length == 0 or full_length > len(buffer):
return 0 return 0
logger.debug(f'Send NameMsg [{self.network_id}/{self.thing_id}] {self.name_length}')
buffer[0:NameMsg.length] = [ buffer[0:NameMsg.length] = [
NameMsg.id, NameMsg.id,
0, #self.network_id, self.network_id,
self.thing_id, self.thing_id,
name_length name_length
] ]

View File

@ -1,16 +1,22 @@
from RoboidControl.Messages.IMessage import IMessage from RoboidControl.Messages.IMessage import IMessage
from typing import Union from typing import Union
import logging
logger = logging.getLogger(__name__)
## A network id message invites another participant to a site ## A message communicating the network ID for that participant
#
## This can be sent in response to a ClientMsg
class NetworkIdMsg(IMessage): class NetworkIdMsg(IMessage):
## The message ID
id: int = 0xA1 id: int = 0xA1
## The length of the message in bytes
length: int = 2 length: int = 2
## Create a network id message
def __init__(self, arg1: Union[bytes, int]): def __init__(self, arg1: Union[bytes, int]):
"""! Create a NetworkIdMsg
@param arg1 Either:
- bytes: contianing the serialized data; or
- int: containgint the network_id
"""
self.network_id: int = 0 self.network_id: int = 0
if isinstance(arg1, bytes): if isinstance(arg1, bytes):
buffer = bytearray(arg1) buffer = bytearray(arg1)
@ -18,11 +24,12 @@ class NetworkIdMsg(IMessage):
else: else:
self.network_id = int(arg1) self.network_id = int(arg1)
## Serialize the message into the given buffer
#
## @param buffer_ref A reference to the buffer to use. This should be a list with the buffer as its first and only element
## @returns the length of the message
def Serialize(self, buffer_ref: list[bytearray]) -> int: def Serialize(self, buffer_ref: list[bytearray]) -> int:
"""!
@copydoc RoboidControl::Messages::IMessage::IMessage::Serialize
"""
logger.debug(f'Send NetworkIdMsg {self.network_id}')
buffer: bytearray = buffer_ref[0] buffer: bytearray = buffer_ref[0]
last:int = NetworkIdMsg.length last:int = NetworkIdMsg.length
buffer[0:last] = [ buffer[0:last] = [

View File

@ -1,61 +1,94 @@
import RoboidControl.Messages.LowLevelMessages as LowLevelMessages import RoboidControl.Messages.LowLevelMessages as LowLevelMessages
from RoboidControl.Messages.IMessage import IMessage from RoboidControl.Messages.IMessage import IMessage
from RoboidControl.Thing import Thing
from LinearAlgebra.Spherical import Spherical from LinearAlgebra.Spherical import Spherical
from LinearAlgebra.Quaternion import Quaternion from LinearAlgebra.Quaternion import Quaternion
from RoboidControl.Thing import Thing
from typing import Union, Optional from typing import Union, Optional
import logging
logger = logging.getLogger(__name__)
class PoseMsg(IMessage): class PoseMsg(IMessage):
"""! Message to communicate the pose of the thing
The pose is in local space relative to the parent. If there is no parent
(the thing is a root thing), the pose will be in world space.
"""
## The message ID
id = 0x10 id = 0x10
## The length of the message in bytes
length = 4 length = 4
Position = 0x01 ## Bit pattern for a pose with position
Orientation = 0x02 Pose_Position = 0x01
LinearVelocity = 0x04 ## Bit pattern for a pose with orientation
AngularVelocity = 0x08 Pose_Orientation = 0x02
## Bit pattern for a pose with linear velocity
Pose_LinearVelocity = 0x04
## Bit pattern for a pose with angular velocity
Pose_AngularVelocity = 0x08
def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing], force: bool = False): def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing], force: bool = False):
"""! Create a PoseMsg
@param arg1 Either:
- bytes: contianing the serialized data; or
- int: containgint the network_id
@param thing The thing for which the data is communicated
@param force If true, position and orientation are always included, even when they are not updated
"""
if thing is None: if thing is None:
buffer = bytes(arg1) buffer = bytes(arg1)
## The network ID of the thing
self.network_id = buffer[1] self.network_id = buffer[1]
## The ID of the thing
self.thing_id = buffer[2] self.thing_id = buffer[2]
## Bit pattern stating which pose components are available
self.pose_type = buffer[3] self.pose_type = buffer[3]
## The position of the thing in local space in meters
self.position: Optional[Spherical] = None self.position: Optional[Spherical] = None
## The orientation of the thing in local space
self.orientation: Optional[Quaternion] = None self.orientation: Optional[Quaternion] = None
## The linear velocity of the thing in local space in meters per second
self.linear_velocity: Optional[Spherical] = None self.linear_velocity: Optional[Spherical] = None
## The angular velocity of the thing in local space
self.angular_velocity: Optional[Spherical] = None self.angular_velocity: Optional[Spherical] = None
ix:int = 4 ix:int = 4
ix_ref = [ix] ix_ref = [ix]
if self.pose_type & PoseMsg.Position != 0: if self.pose_type & PoseMsg.Pose_Position != 0:
self.position = LowLevelMessages.ReceiveSpherical(buffer, ix_ref) self.position = LowLevelMessages.ReceiveSpherical(buffer, ix_ref)
if self.pose_type & PoseMsg.Orientation != 0: if self.pose_type & PoseMsg.Pose_Orientation != 0:
self.orientation = LowLevelMessages.ReceiveQuaternion(buffer, ix_ref) self.orientation = LowLevelMessages.ReceiveQuaternion(buffer, ix_ref)
if self.pose_type & PoseMsg.LinearVelocity != 0: if self.pose_type & PoseMsg.Pose_LinearVelocity != 0:
self.linear_velocity = LowLevelMessages.ReceiveSpherical(buffer, ix_ref) self.linear_velocity = LowLevelMessages.ReceiveSpherical(buffer, ix_ref)
if self.pose_type & PoseMsg.AngularVelocity != 0: if self.pose_type & PoseMsg.Pose_AngularVelocity != 0:
self.angular_velocity = LowLevelMessages.ReceiveSpherical(buffer, ix_ref) self.angular_velocity = LowLevelMessages.ReceiveSpherical(buffer, ix_ref)
else: else:
## The network ID of the thing
self.network_id = arg1 self.network_id = arg1
## The ID of the thing
self.thing = thing self.thing = thing
## Bit pattern stating which pose components are available
self.pose_type = 0 self.pose_type = 0
if thing.position_updated or force: if thing.position_updated or force:
self.pose_type |= PoseMsg.Position self.pose_type |= PoseMsg.Pose_Position
if thing.orientation_updated or force: if thing.orientation_updated or force:
self.pose_type |= PoseMsg.Orientation self.pose_type |= PoseMsg.Pose_Orientation
if thing.linear_velocity_updated or force: if thing.linear_velocity_updated or force:
self.pose_type |= PoseMsg.LinearVelocity self.pose_type |= PoseMsg.Pose_LinearVelocity
if thing.angular_velocity_updated or force: if thing.angular_velocity_updated or force:
self.pose_type |= PoseMsg.AngularVelocity self.pose_type |= PoseMsg.Pose_AngularVelocity
def Serialize(self, buffer_ref): def Serialize(self, buffer_ref):
"""!
@copydoc RoboidControl::Messages::IMessage::IMessage::Serialize
"""
if self.thing is None or self.pose_type == 0: if self.thing is None or self.pose_type == 0:
return 0 return 0
print(f'Send PoseMsg [{self.network_id}/{self.thing.id}] {self.pose_type}') logger.debug(f'Send PoseMsg [{self.network_id}/{self.thing.id}] {self.pose_type}')
buffer: bytearray = buffer_ref[0] buffer: bytearray = buffer_ref[0]
buffer[0:PoseMsg.length] = [ buffer[0:PoseMsg.length] = [
@ -65,12 +98,12 @@ class PoseMsg(IMessage):
self.pose_type self.pose_type
] ]
ix = [4] ix = [4]
if self.pose_type & PoseMsg.Position: if self.pose_type & PoseMsg.Pose_Position:
LowLevelMessages.SendSpherical(buffer, ix, self.thing.position) LowLevelMessages.SendSpherical(buffer, ix, self.thing.position)
if self.pose_type & PoseMsg.Orientation: if self.pose_type & PoseMsg.Pose_Orientation:
LowLevelMessages.SendQuat32(buffer, ix, self.thing.orientation) LowLevelMessages.SendQuat32(buffer, ix, self.thing.orientation)
if self.pose_type & PoseMsg.LinearVelocity: if self.pose_type & PoseMsg.Pose_LinearVelocity:
LowLevelMessages.SendSpherical(buffer, ix, self.thing.linear_velocity) LowLevelMessages.SendSpherical(buffer, ix, self.thing.linear_velocity)
if self.pose_type & PoseMsg.AngularVelocity: if self.pose_type & PoseMsg.Pose_AngularVelocity:
LowLevelMessages.SendSpherical(buffer, ix, self.thing.angular_velocity) LowLevelMessages.SendSpherical(buffer, ix, self.thing.angular_velocity)
return PoseMsg.length + ix[0] return PoseMsg.length + ix[0]

View File

@ -0,0 +1,54 @@
from RoboidControl.Messages.IMessage import IMessage
from typing import Union
import logging
logger = logging.getLogger(__name__)
class TextMsg(IMessage):
"""! Message for sending generic text
"""
## The message ID
id: int = 0xB0
## The length of the message in bytes without the text itself
length: int = 2
def __init__(self, arg1: Union[bytes, str]):
"""! Create a new message for sending
@param arg1 Either:
- bytes: containing the serialized data; or
- str: containing the text
"""
if isinstance(arg1, bytes):
data = arg1
## The text
self.text = data[TextMsg.length:]
## The length of the encoded text
self.text_length = len(self.text)
self.text = self.text.decode("utf-8")
else:
text = str(arg1)
self.text: str = text.encode('utf-8')
## The length of the encoded text
self.text_length = len(self.text)
def Serialize(self, buffer_ref):
"""!
@copydoc RoboidControl::Messages::IMessage::IMessage::Serialize
"""
if buffer_ref is None:
return 0
full_length = TextMsg.length + self.text_length
if self.text_length == 0 or full_length > len(buffer):
return 0
logger.debug(f'Send TextMsg {self.text}')
buffer: bytearray = buffer_ref[0]
buffer[0:TextMsg.length] = [
TextMsg.id,
self.text_length
]
# Append the text string
buffer[TextMsg.length:full_length] = self.text
return full_length

View File

@ -2,30 +2,53 @@ from RoboidControl.Messages.IMessage import IMessage
from RoboidControl.Thing import Thing from RoboidControl.Thing import Thing
from typing import Optional, Union from typing import Optional, Union
import logging
logger = logging.getLogger(__name__)
class ThingMsg(IMessage): class ThingMsg(IMessage):
"""! Message providing generic details about a Thing
"""
## The message ID
id = 0x80 id = 0x80
## The length of the message
length = 5 length = 5
def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing]=None): def __init__(self, arg1: Union[bytes, int], thing: Optional[Thing]=None):
"""! Create a ModelUrlMsg
@param arg1 Either:
- bytes: containing the serialized data; or
- int: containing the network_id
@param thing The thing for which the data is communicated
"""
if thing is None: if thing is None:
buffer = bytes(arg1) buffer = bytes(arg1)
## The network ID of the thing
self.network_id: int = buffer[1] self.network_id: int = buffer[1]
## The ID of the thing
self.thing_id: int = buffer[2] self.thing_id: int = buffer[2]
## The type of thing
self.thing_type: int = buffer[3] self.thing_type: int = buffer[3]
## The ID of the parent thing in the hierarchy. This is zero for root things
self.parent_id: int = buffer[4] self.parent_id: int = buffer[4]
else: else:
## The network ID of the thing
self.network_id = int(arg1) self.network_id = int(arg1)
## The ID of the thing
self.thing_id = thing.id self.thing_id = thing.id
## The type of thing
self.thing_type = thing.type self.thing_type = thing.type
## The ID of the parent thing in the hierarchy. This is zero for root things
if thing.parent is not None: if thing.parent is not None:
self.parent_id = thing.parent.id self.parent_id = thing.parent.id
else: else:
self.parent_id = 0 self.parent_id = 0
def Serialize(self, buffer_ref: list[bytearray]): def Serialize(self, buffer_ref: list[bytearray]):
"""!
@copydoc RoboidControl::Messages::IMessage::IMessage::Serialize
"""
print(f'Send ThingMsg [{self.network_id}/{self.thing_id}] {self.thing_type} {self.parent_id}') logger.debug(f'Send ThingMsg [{self.network_id}/{self.thing_id}] {self.thing_type} {self.parent_id}')
buffer: bytearray = buffer_ref[0] buffer: bytearray = buffer_ref[0]
buffer[0:ThingMsg.length] = [ buffer[0:ThingMsg.length] = [

View File

@ -1,9 +1,10 @@
__all__ = ['BinaryMsg', __all__ = ['BinaryMsg',
'NetworkIdMsg', 'DestroyMsg',
'InvestigateMsg', 'InvestigateMsg',
'ThingMsg', 'IMessage',
'NameMsg',
'ModelUrlMsg', 'ModelUrlMsg',
'NameMsg',
'NetworkIdMsg',
'ParticipantMsg', 'ParticipantMsg',
'PoseMsg', 'PoseMsg',
'IMessage'] 'ThingMsg']

View File

@ -10,6 +10,7 @@ class Participant:
It also maintains the communcation information to contact the participant. It also maintains the communcation information to contact the participant.
It is used as a basis for the local participant, but also as a reference to remote participants. It is used as a basis for the local participant, but also as a reference to remote participants.
""" """
def __init__(self, ip_address: str, port: int) -> None: def __init__(self, ip_address: str, port: int) -> None:
"""! Create a new participant with the given communcation info """! Create a new participant with the given communcation info
@param ip_address The IP address of the participant @param ip_address The IP address of the participant
@ -64,7 +65,7 @@ class Participant:
for thing in list(self.things): for thing in list(self.things):
thing.Update(currentTimeMs) thing.Update(currentTimeMs)
participants: set['Participant'] participants: set['Participant'] = set()
@staticmethod @staticmethod
def GetParticipant(arg1: Union[str, int], port: Optional[int]) -> Optional['Participant']: def GetParticipant(arg1: Union[str, int], port: Optional[int]) -> Optional['Participant']:
@ -81,7 +82,7 @@ class Participant:
return participant return participant
return None return None
def AddParticipant(arg1: Union[str, int], port: Optional[int]) -> 'Participant': def AddParticipant(arg1: Union[str, 'Participant'], port: Optional[int] = None) -> 'Participant':
if port is not None: if port is not None:
ip_address = str(arg1) ip_address = str(arg1)
participant = Participant(ip_address, port) participant = Participant(ip_address, port)
@ -89,8 +90,8 @@ class Participant:
Participant.AddParticipant(participant) Participant.AddParticipant(participant)
return participant return participant
else: else:
participant = Participant(arg1) participant: Participant = arg1
foundParticipant = Participant.GetParticipant(participant.network_id) foundParticipant = Participant.GetParticipant(participant.network_id, participant.port)
if foundParticipant is not None: if foundParticipant is not None:
Participant.participants.add(participant) Participant.participants.add(participant)
return participant return participant

View File

@ -1,6 +1,5 @@
from RoboidControl.Participant import Participant from RoboidControl.Participant import Participant
from RoboidControl.Thing import Thing from RoboidControl.Thing import Thing
# from RoboidControl.Messages.ParticipantMsg import ParticipantMsg
# from RoboidControl.Messages.NetworkIdMsg import NetworkIdMsg # from RoboidControl.Messages.NetworkIdMsg import NetworkIdMsg
# from RoboidControl.Messages.ThingMsg import ThingMsg # from RoboidControl.Messages.ThingMsg import ThingMsg
# from RoboidControl.Messages.NameMsg import NameMsg # from RoboidControl.Messages.NameMsg import NameMsg
@ -9,6 +8,7 @@ from RoboidControl.Thing import Thing
# from RoboidControl.Messages.InvestigateMsg import InvestigateMsg # from RoboidControl.Messages.InvestigateMsg import InvestigateMsg
# from RoboidControl.Messages.PoseMsg import PoseMsg # from RoboidControl.Messages.PoseMsg import PoseMsg
from RoboidControl.Messages import * from RoboidControl.Messages import *
from RoboidControl.Messages.ParticipantMsg import ParticipantMsg
import socket import socket
import threading import threading
@ -89,21 +89,21 @@ class ParticipantUDP(Participant):
isolated_participant = None isolated_participant = None
def GetParticipant(self, ip_address: str, port: int): # def GetParticipant(self, ip_address: str, port: int):
# print(f'{self.name} Get participant {ip_address} {port}') # # print(f'{self.name} Get participant {ip_address} {port}')
# for item in self.others: # # for item in self.others:
# print(f'- {item.ip_address} {item.port}') # # print(f'- {item.ip_address} {item.port}')
found_participants = (item for item in self.others # found_participants = (item for item in self.others
if item.ip_address == ip_address and item.port == port) # if item.ip_address == ip_address and item.port == port)
participant = next(found_participants, None) # participant = next(found_participants, None)
return participant # return participant
def AddParticipant(self, ip_address: str, port: int): # def AddParticipant(self, ip_address: str, port: int):
print(f'{self.name} Add participant {ip_address} {port}') # print(f'{self.name} Add participant {ip_address} {port}')
remote_participant = Participant(ip_address = ip_address, port = port) # remote_participant = Participant(ip_address = ip_address, port = port)
self.others.append(remote_participant) # self.others.append(remote_participant)
return remote_participant # return remote_participant
#region Update #region Update
@ -137,10 +137,10 @@ class ParticipantUDP(Participant):
thing.Update(currentTimeMs, False) thing.Update(currentTimeMs, False)
if not(self.is_isolated or self.network_id == 0): if not(self.is_isolated or self.network_id == 0):
# if thing.terminate: if thing.terminate:
# destroyMsg = DestroyMsg(self.network_id, thing) destroyMsg = DestroyMsg.Create(self.network_id, thing)
# self.Send(self.remote_site, destroyMsg) self.Send(self.remote_site, destroyMsg)
# else: else:
if self.remote_site is not None and thing.owner is not None: if self.remote_site is not None and thing.owner is not None:
# Send to remote site # Send to remote site
poseMsg = PoseMsg(thing.owner.network_id, thing) poseMsg = PoseMsg(thing.owner.network_id, thing)
@ -201,10 +201,10 @@ class ParticipantUDP(Participant):
remote_ip_address = addr[0] remote_ip_address = addr[0]
remote_port = addr[1] remote_port = addr[1]
# print(f'msg received from {remote_ip_address}:{remote_port}') # print(f'msg received from {remote_ip_address}:{remote_port}')
remote_participant = self.GetParticipant(remote_ip_address, remote_port) remote_participant = Participant.GetParticipant(remote_ip_address, remote_port)
if remote_participant is None: if remote_participant is None:
# print(f'new participant') # print(f'new participant')
remote_participant = self.AddParticipant(remote_ip_address, remote_port) remote_participant = Participant.AddParticipant(remote_ip_address, remote_port)
self.ReceiveData(data, remote_participant) self.ReceiveData(data, remote_participant)
except ConnectionError: except ConnectionError:
self.network_id = 0 self.network_id = 0
@ -223,7 +223,7 @@ class ParticipantUDP(Participant):
case ThingMsg.id: case ThingMsg.id:
self.ProcessThingMsg(ThingMsg(data)) self.ProcessThingMsg(ThingMsg(data))
case NameMsg.id: case NameMsg.id:
self.ProcessNameMsg(NameMsg(data)) self.ProcessNameMsg(NameMsg.NameMsg.Deserialize(data))
case ModelUrlMsg.id: case ModelUrlMsg.id:
self.ProcessModelUrlMsg(ModelUrlMsg(data)) self.ProcessModelUrlMsg(ModelUrlMsg(data))
case BinaryMsg.id: case BinaryMsg.id:
@ -250,6 +250,16 @@ class ParticipantUDP(Participant):
def ProcessNameMsg(self, msg: NameMsg): def ProcessNameMsg(self, msg: NameMsg):
logger.debug(f'{self.name}: Process NameMsg [{msg.networkId}/{msg.thingId}] {msg.nameLength} {msg.name}') logger.debug(f'{self.name}: Process NameMsg [{msg.networkId}/{msg.thingId}] {msg.nameLength} {msg.name}')
owner: Optional[Participant] = Participant.GetParticipant(msg.network_id)
if owner is None:
return
thing: Optional[Thing] = self.Get(msg.thing_id)
if thing is None:
return
thing.name = msg.name
def ProcessModelUrlMsg(self, msg: ModelUrlMsg): def ProcessModelUrlMsg(self, msg: ModelUrlMsg):
logger.debug(f'{self.name}: Process ModelUrlMsg [{msg.networkId}/{msg.thingId}] {msg.urlLength} {msg.url}') logger.debug(f'{self.name}: Process ModelUrlMsg [{msg.networkId}/{msg.thingId}] {msg.urlLength} {msg.url}')

View File

@ -1,5 +1,2 @@
__all__ = ['Thing', __all__ = ['Thing',
'ParticipantUDP'] 'Participant']
from .Participants.ParticipantUDP import ParticipantUDP
from .Thing import Thing