From 48d538a73a4f16855c74f3baf8b395b80791ddd7 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 11 Jun 2025 14:23:51 +0200 Subject: [PATCH] Update remote thing pose --- Unity/DifferentialDrive.cs | 6 +++--- src/Thing.cs | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Unity/DifferentialDrive.cs b/Unity/DifferentialDrive.cs index e8f8858..d56f73f 100644 --- a/Unity/DifferentialDrive.cs +++ b/Unity/DifferentialDrive.cs @@ -133,9 +133,9 @@ namespace RoboidControl.Unity { rb.velocity = 0.9f * rb.velocity + 0.1f * forwardSpeed * transform.forward; rb.angularVelocity = 0.9f * rb.angularVelocity + 0.1f * turningSpeed * Vector3.up; - core.position = LinearAlgebra.Spherical.FromVector3(this.transform.localPosition); - core.orientation = LinearAlgebra.SwingTwist.FromQuaternion(this.transform.localRotation); - + core.ReplacePosition(LinearAlgebra.Spherical.FromVector3(this.transform.localPosition)); + core.ReplaceOrientation(LinearAlgebra.SwingTwist.FromQuaternion(this.transform.localRotation)); + } } } diff --git a/src/Thing.cs b/src/Thing.cs index 56e3f16..34b3d93 100644 --- a/src/Thing.cs +++ b/src/Thing.cs @@ -316,6 +316,10 @@ namespace RoboidControl { /// public bool positionUpdated = false; + public void ReplacePosition(Spherical newPosition) { + this._position = newPosition; + } + private SwingTwist _orientation = SwingTwist.zero; /// /// The orientation of the thing in local space @@ -336,6 +340,10 @@ namespace RoboidControl { /// public bool orientationUpdated = false; + public void ReplaceOrientation(SwingTwist newOrientation) { + this._orientation = newOrientation; + } + private Spherical _linearVelocity = Spherical.zero; /// /// The linear velocity of the thing in local space in meters per second