Compatibility

This commit is contained in:
Pascal Serrarens 2025-05-28 12:35:19 +02:00
parent 7f3698ecaa
commit 63b5a75618
7 changed files with 19 additions and 20 deletions

View File

@ -1,3 +1,4 @@
#if !UNITY_5_6_OR_NEWER
using NUnit.Framework; using NUnit.Framework;
namespace LinearAlgebra.Test { namespace LinearAlgebra.Test {
@ -14,4 +15,5 @@ namespace LinearAlgebra.Test {
Assert.True(r); Assert.True(r);
} }
}; };
} }
#endif

View File

@ -56,7 +56,7 @@ namespace RoboidControl.Unity {
// Normalize angles to range [-180..180) // Normalize angles to range [-180..180)
// Note: it is not possible to track rotation speeds higher than 180 degrees per frame because of representation limitations of Quaternions // Note: it is not possible to track rotation speeds higher than 180 degrees per frame because of representation limitations of Quaternions
float deltaAngle = Angle.Normalize(deltaRotation.eulerAngles.x); float deltaAngle = Angle.Degrees(deltaRotation.eulerAngles.x).inDegrees;
this.rotationSpeed = deltaAngle / Time.deltaTime; this.rotationSpeed = deltaAngle / Time.deltaTime;
} }

View File

@ -190,19 +190,19 @@ namespace RoboidControl.Unity {
SkinnedMeshRenderer[] meshRenderers = parentTransform.GetComponentsInChildren<SkinnedMeshRenderer>(); SkinnedMeshRenderer[] meshRenderers = parentTransform.GetComponentsInChildren<SkinnedMeshRenderer>();
#if pHUMANOID4 #if pHUMANOID4
if (parentThing.objectType == 7) { // if (parentThing.objectType == 7) {
HumanoidControl hc = parentThing.gameObject.GetComponent<HumanoidControl>(); // HumanoidControl hc = parentThing.gameObject.GetComponent<HumanoidControl>();
if (hc == null) // if (hc == null)
hc = parentThing.gameObject.AddComponent<HumanoidControl>(); // hc = parentThing.gameObject.AddComponent<HumanoidControl>();
foreach (SkinnedMeshRenderer meshRenderer in meshRenderers) { // foreach (SkinnedMeshRenderer meshRenderer in meshRenderers) {
if (meshRenderer.rootBone != null) { // if (meshRenderer.rootBone != null) {
Debug.Log("Found a skinned mesh with bones"); // Debug.Log("Found a skinned mesh with bones");
hc.RetrieveBonesFrom(meshRenderer.rootBone); // hc.RetrieveBonesFrom(meshRenderer.rootBone);
break; // break;
} // }
} // }
} // }
#endif #endif
parentTransform.localScale = Vector3.one; parentTransform.localScale = Vector3.one;
if (meshRenderers.Length > 0) { if (meshRenderers.Length > 0) {

View File

@ -38,7 +38,7 @@ namespace RoboidControl.Unity {
GameObject gameObj = Instantiate(prefab); GameObject gameObj = Instantiate(prefab);
Wheel component = gameObj.GetComponent<Wheel>(); Wheel component = gameObj.GetComponent<Wheel>();
if (component != null) if (component != null)
component.core = new RoboidControl.Thing(RoboidControl.Thing.Type.UncontrolledMotor, false); component.core = new RoboidControl.Thing(RoboidControl.Thing.Type.UncontrolledMotor);
return component; return component;
} }
else { else {
@ -49,7 +49,8 @@ namespace RoboidControl.Unity {
SiteServer participant = FindAnyObjectByType<SiteServer>(); SiteServer participant = FindAnyObjectByType<SiteServer>();
RoboidControl.Thing core = participant.coreParticipant.Get(thingId); RoboidControl.Thing core = participant.coreParticipant.Get(thingId);
if (core == null) if (core == null)
core = new(participant.coreParticipant, RoboidControl.Thing.Type.UncontrolledMotor, thingId, false); //core = new(participant.coreParticipant, RoboidControl.Thing.Type.UncontrolledMotor, thingId, false);
core = RoboidControl.Thing.CreateRemote(participant.coreParticipant, RoboidControl.Thing.Type.UncontrolledMotor, thingId);
else { else {
; ;
} }

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Reflection.Metadata;
namespace RoboidControl { namespace RoboidControl {

View File

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using LinearAlgebra; using LinearAlgebra;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection;
namespace RoboidControl { namespace RoboidControl {

View File

@ -1,6 +1,4 @@
using NUnit.Framework;
namespace RoboidControl { namespace RoboidControl {
/// @brief An Incremental Encoder measures the rotations of an axle using a rotary /// @brief An Incremental Encoder measures the rotations of an axle using a rotary