Skip to content

Commit 5bd82bb

Browse files
committed
updated urdf joint limits (sill not working)
1 parent 214b998 commit 5bd82bb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Runtime/Scripts/Util/ImportExport/ZOExportURDF.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public struct CollisionMesh {
6363
}
6464
private List<CollisionMesh> _collisionMeshesToExport = new List<CollisionMesh>();
6565

66-
66+
6767
public List<CollisionMesh> CollisionMeshesToExport {
6868
get { return _collisionMeshesToExport; }
6969
}
@@ -264,16 +264,19 @@ protected void BuildURDFJoints(XElement robot, ZOSimOccurrence parent, ZOSimOccu
264264
jointX.SetAttributeValue("type", "prismatic");
265265

266266
// create axis
267-
Vector3 axis = -prismaticJoint.Axis.Unity2Ros(); // NOTE: need to negate axis
267+
Vector3 axis = prismaticJoint.Axis.Unity2Ros();
268268
XElement axisX = new XElement("axis");
269269
axisX.SetAttributeValue("xyz", axis.ToXMLString());
270270
jointX.Add(axisX);
271271

272272
// create limits
273273
// TODO:
274274
XElement limitX = new XElement("limit");
275-
limitX.SetAttributeValue("lower", prismaticJoint.JointLimits.LowerLimit);
276-
limitX.SetAttributeValue("upper", prismaticJoint.JointLimits.UpperLimit);
275+
limitX.SetAttributeValue("lower", -prismaticJoint.UnityConfigurableJoint.linearLimit.limit); //HACK: quick hack to get the "correct" limit
276+
limitX.SetAttributeValue("upper", prismaticJoint.UnityConfigurableJoint.linearLimit.limit); //HACK: quick hack to get the "correct" limit
277+
278+
// limitX.SetAttributeValue("lower", prismaticJoint.JointLimits.LowerLimit);
279+
// limitX.SetAttributeValue("upper", prismaticJoint.JointLimits.UpperLimit);
277280
limitX.SetAttributeValue("effort", 10000f); // HACK
278281
limitX.SetAttributeValue("velocity", 10000f); // HACK
279282
jointX.Add(limitX);
@@ -287,7 +290,7 @@ protected void BuildURDFJoints(XElement robot, ZOSimOccurrence parent, ZOSimOccu
287290
jointMatrix = prismaticJoint.transform.WorldTranslationRotationMatrix();
288291
jointMatrix = jointMatrix.AddTranslation(prismaticJoint.Anchor);
289292

290-
// TODO: the links should be offset by the connected anchor. Not the way done below.
293+
// TODO: the links should be offset by the connected anchor. Not the way done below.
291294
Vector3 worldConnectedAnchor = prismaticJoint.ConnectedBody.transform.TransformPoint(prismaticJoint.ConnectedAnchor);
292295
Vector3 relativeToParentConnectedAnchor = prismaticJoint.transform.InverseTransformPoint(worldConnectedAnchor);
293296
// jointMatrix = jointMatrix.AddTranslation(relativeToParentConnectedAnchor);

0 commit comments

Comments
 (0)