Carlos
Carlos

Reputation: 23

Generating and manipulating multiple models into an iiwa arm MeshCat simulation in Drake

I am trying to make a simple simulation where an iiwa arm picks up foam bricks from a tower. However I have been running into issues finding a way to generate multiple bricks and moving them. The block of code below is how I am currently generating this tower, but this results in the bricks being unable to move the Z plane that they are generated on.

sdf = FindResourceOrThrow("drake/examples/manipulation_station/models/061_foam_brick.sdf")
z=0.35
for i in range(2):
        planar_joint_frame = plant.AddFrame(FixedOffsetFrame("planar_joint_frame", plant.world_frame(), RigidTransform(RotationMatrix.MakeZRotation(np.pi/2),[-0.4, 0.2, z])))
        instance = parser.AddModelFromFile(sdf, f"object{i}")   
        plant.AddJoint(PlanarJoint(f"joint{i}", planar_joint_frame, plant.GetFrameByName("base_link", instance), damping=[0,0,0]))
        z+=0.05

Is there another way to generate multiple models that can be manipulated by the iiwa arm?

Upvotes: 0

Views: 70

Answers (1)

Russ Tedrake
Russ Tedrake

Reputation: 5533

If you want them free to move in 3D, then you don't want to add the planar joint. In fact, you don't need any joint (for them to be free). You probably want something as simple as

for i in range(2):
  instance = parser.AddModelFromFile(sdf, f"object{i}")

??

Upvotes: 0

Related Questions