Improve external motor control
This commit is contained in:
parent
d5c301fa86
commit
ac11382479
@ -125,7 +125,6 @@ namespace RoboidControl.Unity {
|
|||||||
|
|
||||||
// Use smoothing to emulate motor inertia
|
// Use smoothing to emulate motor inertia
|
||||||
rb.velocity = 0.9f * rb.velocity + 0.1f * forwardSpeed * transform.forward;
|
rb.velocity = 0.9f * rb.velocity + 0.1f * forwardSpeed * transform.forward;
|
||||||
Debug.Log(rb.velocity);
|
|
||||||
rb.angularVelocity = 0.9f * rb.angularVelocity + 0.1f * turningSpeed * Vector3.up;
|
rb.angularVelocity = 0.9f * rb.angularVelocity + 0.1f * turningSpeed * Vector3.up;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ namespace RoboidControl {
|
|||||||
/// The interval in milliseconds for publishing (broadcasting) data on the local network
|
/// The interval in milliseconds for publishing (broadcasting) data on the local network
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong publishIntervalMS = 3000; // = 3 seconds
|
public ulong publishIntervalMS = 3000; // = 3 seconds
|
||||||
public ulong sendUpdateIntervalMS = 100; // for object updates
|
public ulong sendUpdateIntervalMS = 100; // = 0.1 seconds for object updates
|
||||||
|
|
||||||
//public byte[] buffer = new byte[1024];
|
//public byte[] buffer = new byte[1024];
|
||||||
|
|
||||||
@ -219,8 +219,8 @@ namespace RoboidControl {
|
|||||||
// this.Send(participant, poseMsg);
|
// this.Send(participant, poseMsg);
|
||||||
// BinaryMsg binaryMsg = new(thing.owner.networkId, thing);
|
// BinaryMsg binaryMsg = new(thing.owner.networkId, thing);
|
||||||
// this.Send(participant, binaryMsg);
|
// this.Send(participant, binaryMsg);
|
||||||
participant.Send(new PoseMsg(thing.owner.networkId, thing));
|
// participant.Send(new PoseMsg(thing.owner.networkId, thing));
|
||||||
participant.Send(new BinaryMsg(thing.owner.networkId, thing));
|
// participant.Send(new BinaryMsg(thing.owner.networkId, thing));
|
||||||
}
|
}
|
||||||
this.nextSendUpdate = currentTimeMS + this.sendUpdateIntervalMS;
|
this.nextSendUpdate = currentTimeMS + this.sendUpdateIntervalMS;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,8 @@ namespace RoboidControl {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
public override void ProcessBinary(byte[] data) {
|
public override void ProcessBinary(byte[] data) {
|
||||||
this.targetSpeed = (float)(sbyte)data[0] / 127;
|
this._targetSpeed = (float)(sbyte)data[0] / 127;
|
||||||
|
updateQueue.Enqueue(new CoreEvent(BinaryMsg.Id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user