Skip to content

Commit 41bd496

Browse files
committed
Merge branch 'feature/urdf_import' into develop
2 parents 85e700e + f034e4c commit 41bd496

File tree

7 files changed

+474
-210
lines changed

7 files changed

+474
-210
lines changed

Editor/ZOZeroSimMenu.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,18 @@ static void ImportURDF(MenuCommand menuCommand) {
5353

5454
}
5555

56+
[MenuItem("GameObject/ZeroSim/Import OBJ...", false, 0)]
57+
static void ImportOBJ(MenuCommand menuCommand) {
58+
string filePath = EditorUtility.OpenFilePanel("Import OBJ", ".", "obj");
59+
60+
if (filePath.Length == 0) {
61+
return;
62+
}
63+
64+
ZOImportOBJ.Import(filePath);
65+
66+
}
67+
68+
5669
}
5770
}

Runtime/Scripts/Physics/ZOHingeJoint.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public Vector3 Axis {
7979
return UnityHingeJoint.axis;
8080
}
8181
set {
82+
_axis = value;
8283
UnityHingeJoint.axis = value;
8384
}
8485
}
@@ -92,6 +93,7 @@ public Vector3 Anchor {
9293
return UnityHingeJoint.anchor;
9394
}
9495
set {
96+
_anchor = value;
9597
UnityHingeJoint.anchor = value;
9698
}
9799
}
@@ -112,6 +114,7 @@ public Rigidbody ConnectedBody {
112114
}
113115
set {
114116
if (UnityHingeJoint.connectedBody != value) {
117+
_connectedBody = value;
115118
UnityHingeJoint.connectedBody = value;
116119
}
117120

Runtime/Scripts/Util/Extensions/ZOROSConversionExtensions.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,26 @@ public static Vector3 Unity2RosRollPitchYaw(this Quaternion q) {
3333
-q.eulerAngles.y * Mathf.Deg2Rad);
3434
}
3535

36+
public static Quaternion RosRollPitchYawToQuaternion(this Vector3 rpy) {
37+
// Negate X and Z because we're going from Right to Left handed rotations. Y is handled because the axis itself is flipped
38+
rpy.x *= -1;
39+
rpy.z *= -1;
40+
rpy *= Mathf.Rad2Deg;
41+
42+
// swap the angle values
43+
rpy = new Vector3(rpy.y, rpy.z, rpy.x);
44+
45+
// Applying rotations in ZYX ordering, as indicated above
46+
Quaternion q = Quaternion.identity;
47+
48+
q *= Quaternion.Euler(0, rpy.y, 0);
49+
q *= Quaternion.Euler(rpy.x, 0, 0);
50+
q *= Quaternion.Euler(0, 0, rpy.z);
51+
52+
53+
return q;
54+
}
55+
3656
public static string ToXMLString(this Vector3 v) {
3757
return $"{v.x} {v.y} {v.z}";
3858
}
@@ -58,7 +78,7 @@ public static Vector3 FromURDFStringToVector3(this string s) {
5878
Debug.LogWarning($"Could not parse string: {s}");
5979

6080
return Vector3.zero;
61-
}
81+
}
6282

6383

6484
}

0 commit comments

Comments
 (0)