Create placeholder motors when they are not found

This commit is contained in:
Pascal Serrarens 2025-06-06 09:13:38 +02:00
parent 87241a0279
commit 5759412f70

View File

@ -49,7 +49,7 @@ namespace RoboidControl {
// this.leftWheel.position = new Spherical(distance, Direction.left);
this.rightWheel = rightWheel;
this.rightWheel.parent= this;
this.rightWheel.parent = this;
// if (this.rightWheel != null)
// this.rightWheel.position = new Spherical(distance, Direction.right);
@ -139,8 +139,12 @@ namespace RoboidControl {
byte ix = 0;
byte leftWheelId = data[ix++];
this.leftWheel = this.owner.Get(leftWheelId) as Motor;
this.leftWheel ??= new Motor(this) { id = leftWheelId };
byte rightWheelId = data[ix++];
this.rightWheel = this.owner.Get(rightWheelId) as Motor;
this.rightWheel ??= new Motor(this) { id = rightWheelId };
this._wheelRadius = LowLevelMessages.ReceiveFloat16(data, ref ix);
//this._wheelSeparation = LowLevelMessages.ReceiveFloat16(data, ref ix);
this.updateQueue.Enqueue(new CoreEvent(BinaryMsg.Id));