Support sending poses from Unity changes
This commit is contained in:
parent
3cf49f649d
commit
5ef609fd12
@ -29,11 +29,18 @@ namespace LinearAlgebra {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
|
public static SwingTwist FromQuaternion(Quaternion q) {
|
||||||
|
// q.ToAngles(out float right, out float up, out float forward);
|
||||||
|
UnityEngine.Vector3 angles = q.eulerAngles;
|
||||||
|
SwingTwist r = new SwingTwist(angles.y, angles.x, angles.z);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
public Quaternion ToQuaternion() {
|
public Quaternion ToQuaternion() {
|
||||||
Quaternion q = Quaternion.Euler(-this.swing.vertical,
|
Quaternion q = Quaternion.Euler(-this.swing.vertical,
|
||||||
this.swing.horizontal,
|
this.swing.horizontal,
|
||||||
this.twist);
|
this.twist);
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@ namespace RoboidControl.Unity {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void FixedUpdate() {
|
protected virtual void FixedUpdate() {
|
||||||
UpdateThing();
|
UpdateThing();
|
||||||
|
core.orientation = LinearAlgebra.SwingTwist.FromQuaternion(this.transform.localRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -340,6 +340,7 @@ namespace RoboidControl {
|
|||||||
if (_orientation != value) {
|
if (_orientation != value) {
|
||||||
_orientation = value;
|
_orientation = value;
|
||||||
orientationUpdated = true;
|
orientationUpdated = true;
|
||||||
|
updateQueue.Enqueue(new CoreEvent(PoseMsg.Id));
|
||||||
//OnOrientationChanged?.Invoke();
|
//OnOrientationChanged?.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user