Hello. I am using franka robot to create peg in hole environment.
I’d like to decorate the environment with peg (square box) on the hand of the franka robot. I want to fix it with a fixed joint(add-Physic-Joint-Fixed joint), but I don’t know how to combine or assembly it. Is there a way??
You can use a Surface Gripper in the hand of the robot to rigidly attach the peg. It uses a fixed joint internally, you can also set other parameters such as the max force before the joint breaks.
If you want to manually set the fixed joint you can use the following code as an example:
import omni.usd
from pxr import Gf, UsdPhysics
stage = omni.usd.get_context().get_stage()
d6FixedJoint = UsdPhysics.Joint.Define(stage, "/gripper_fixed_joint")
d6FixedJoint.CreateBody0Rel().SetTargets(["/Franka/panda_hand"])
d6FixedJoint.CreateBody1Rel().SetTargets(["/peg"])
d6FixedJoint.CreateLocalPos0Attr().Set(Gf.Vec3f(-0.11, 0, 0.105))
d6FixedJoint.CreateLocalRot0Attr().Set(Gf.Quatf(1.0, Gf.Vec3f(0, 0, 0)))
d6FixedJoint.CreateLocalPos1Attr().Set(Gf.Vec3f(0, 0.0, 0.0))
d6FixedJoint.CreateLocalRot1Attr().Set(Gf.Quatf(1.0, Gf.Vec3f(0, 0, 0)))
# lock all 6DOF (lock - low is greater than high)
d6Prim = stage.GetPrimAtPath("/gripper_fixed_joint")
limitAPI = UsdPhysics.LimitAPI.Apply(d6Prim, "transX")
limitAPI.CreateLowAttr(1.0)
limitAPI.CreateHighAttr(-1.0)
limitAPI = UsdPhysics.LimitAPI.Apply(d6Prim, "transY")
limitAPI.CreateLowAttr(1.0)
limitAPI.CreateHighAttr(-1.0)
limitAPI = UsdPhysics.LimitAPI.Apply(d6Prim, "transZ")
limitAPI.CreateLowAttr(1.0)
limitAPI.CreateHighAttr(-1.0)
limitAPI = UsdPhysics.LimitAPI.Apply(d6Prim, "rotX")
limitAPI.CreateLowAttr(10.0)
limitAPI.CreateHighAttr(-10.0)
limitAPI = UsdPhysics.LimitAPI.Apply(d6Prim, "rotY")
limitAPI.CreateLowAttr(10.0)
limitAPI.CreateHighAttr(-10.0)
limitAPI = UsdPhysics.LimitAPI.Apply(d6Prim, "rotZ")
limitAPI.CreateLowAttr(10.0)
limitAPI.CreateHighAttr(-10.0)