fix(local_hammer_nail): make the board/nail USDs render, and publish the wall variant

#26
by Everloom - opened
assets/local_hammer_nail/board_nail_wall.urdf ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!-- Wall + horizontal nail for hammer_insert_nail_wall, as a URDF so IsaacLab's
3
+ UrdfConverter can produce the articulated USD the IsaacSim backend needs
4
+ (metasim's isaac handler spawns ArticulationObjCfg from a USD, not an MJCF).
5
+ Mirrors the MuJoCo board_nail_wall.xml: a fixed upright wall with a nail on a
6
+ HORIZONTAL prismatic joint (nail_drive, axis -x => driven +x into the wall).
7
+ Used for RENDERING only (physics stays MuJoCo in the hybrid path); the joint
8
+ must exist so metasim can mirror the nail's slide into the IsaacSim render
9
+ each frame. URDF cylinders default to the z axis, so the nail shaft/head are
10
+ pitched 90 deg (rpy 0 1.5708 0) to lie along x, matching the MJCF fromto. -->
11
+ <robot name="board_nail_wall">
12
+ <link name="wall">
13
+ <visual>
14
+ <origin xyz="0.03 0 0.15" rpy="0 0 0"/>
15
+ <geometry><box size="0.06 0.30 0.30"/></geometry>
16
+ <!-- brick texture (mirrors the MJCF cube material); IsaacLab's UrdfConverter
17
+ bakes it into the render-only USD. Falls back to the color if unsupported. -->
18
+ <material name="brick">
19
+ <color rgba="0.62 0.32 0.26 1"/>
20
+ <texture filename="textures/wall_brick.png"/>
21
+ </material>
22
+ </visual>
23
+ <collision>
24
+ <origin xyz="0.03 0 0.15" rpy="0 0 0"/>
25
+ <geometry><box size="0.06 0.30 0.30"/></geometry>
26
+ </collision>
27
+ <inertial>
28
+ <origin xyz="0.03 0 0.15" rpy="0 0 0"/>
29
+ <mass value="0.5"/>
30
+ <inertia ixx="4e-3" iyy="2e-3" izz="2e-3" ixy="0" ixz="0" iyz="0"/>
31
+ </inertial>
32
+ </link>
33
+
34
+ <link name="nail">
35
+ <visual>
36
+ <origin xyz="0 0 0" rpy="0 1.5708 0"/>
37
+ <geometry><cylinder radius="0.003" length="0.06"/></geometry>
38
+ <material name="steel"><color rgba="0.72 0.72 0.75 1"/></material>
39
+ </visual>
40
+ <visual>
41
+ <origin xyz="-0.0325 0 0" rpy="0 1.5708 0"/>
42
+ <geometry><cylinder radius="0.009" length="0.005"/></geometry>
43
+ <material name="steel_head"><color rgba="0.70 0.70 0.74 1"/></material>
44
+ </visual>
45
+ <collision>
46
+ <origin xyz="-0.0325 0 0" rpy="0 1.5708 0"/>
47
+ <geometry><cylinder radius="0.009" length="0.005"/></geometry>
48
+ </collision>
49
+ <inertial>
50
+ <origin xyz="0 0 0" rpy="0 0 0"/>
51
+ <mass value="0.04"/>
52
+ <inertia ixx="2e-6" iyy="2e-5" izz="2e-5" ixy="0" ixz="0" iyz="0"/>
53
+ </inertial>
54
+ </link>
55
+
56
+ <joint name="nail_drive" type="prismatic">
57
+ <parent link="wall"/>
58
+ <child link="nail"/>
59
+ <origin xyz="0 0 0.09" rpy="0 0 0"/>
60
+ <axis xyz="-1 0 0"/>
61
+ <limit lower="-0.04" upper="0.0" effort="100" velocity="1.0"/>
62
+ <dynamics friction="15.0" damping="10.0"/>
63
+ </joint>
64
+ </robot>
assets/local_hammer_nail/board_nail_wall.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <mujoco model="board_nail_wall">
2
+ <!-- Wall + horizontal nail for the hammer_insert_nail_wall task, the HORIZONTAL
3
+ sibling of board_nail.xml. The nail hangs off a fixed upright WALL by a
4
+ single HORIZONTAL slide joint with dry friction (frictionloss), driven
5
+ along +x INTO the wall by a hammer strike.
6
+
7
+ Why a wall (vs the tabletop board): the slide axis lies in the table plane,
8
+ so gravity (-z) is PERPENDICULAR to the only free DOF and is fully absorbed
9
+ by the joint constraint — the nail can NEVER creep in on its own, no matter
10
+ how soft the friction constraint. Only a horizontal strike whose impulse
11
+ exceeds the frictionloss drives it. (The vertical board_nail needs a stiff
12
+ solreffriction to stop gravity sag; here gravity does no work along x.)
13
+
14
+ Modeling notes (mirror board_nail.xml):
15
+ - nail SHAFT collision OFF (contype=0/conaffinity=0): its going "into the
16
+ wall" is faked by the slide joint, so it must not fight real contact with
17
+ the wall. Only the nail HEAD keeps collision — the surface the hammer
18
+ strikes (from the -x / robot side, pushing +x into the wall).
19
+ - damping spreads the drive over several strikes (one blow does not bottom
20
+ it out); armature kills passive creep; solreffriction stiffens the
21
+ friction constraint (harmless here, kept for parity with board_nail).
22
+ - Loaded as ArticulationObjCfg(fix_base_link=True); the root "wall" body
23
+ carries no pos/quat (set via cfg default_position). The wall's near face
24
+ (toward the robot) is at the root origin (x=0), so the nail body origin
25
+ starts flush with the face and drives +x into the wall.
26
+ - Success is read from the nail body world x (insertion depth along +x):
27
+ nail_drive 0 = flush at the face, range floor -0.04 = fully driven. -->
28
+ <compiler angle="radian"/>
29
+ <asset>
30
+ <!-- Real brick-wall image texture (running-bond bricks + mortar + speckle),
31
+ generated once and shipped next to this MJCF. Mapped onto the wall box so
32
+ it reads as an actual brick wall rather than a flat colour. The nail HEAD
33
+ and SHAFT keep flat rgba (metal). -->
34
+ <!-- type="cube" (not "2d"): MuJoCo maps a 2d texture onto box faces degenerately
35
+ (one row stretched into vertical stripes); a cube texture paints the full
36
+ brick image on every face. The PNG is pre-rotated so courses run horizontal. -->
37
+ <texture name="wall_brick_tex" type="cube" file="textures/wall_brick.png"/>
38
+ <material name="wall_brick_mat" texture="wall_brick_tex" texuniform="false"
39
+ texrepeat="1 1" rgba="1 1 1 1" specular="0.05" shininess="0.05"/>
40
+ </asset>
41
+ <worldbody>
42
+ <body name="wall">
43
+ <!-- Upright brick wall standing on the table: 6 cm thick (x) x 30 cm wide (y)
44
+ x 30 cm tall (z); near face at x=0 (robot side), far face at x=0.06. The
45
+ near face is kept at x=0 so the nail rest world x (and thus the checker's
46
+ along-x gate) is unchanged when the wall is resized. -->
47
+ <geom name="wall" type="box" size="0.03 0.15 0.15" pos="0.03 0 0.15"
48
+ material="wall_brick_mat" friction="0.9 0.05 0.001" density="500"/>
49
+ <body name="nail" pos="0 0 0.09">
50
+ <joint name="nail_drive" type="slide" axis="-1 0 0" range="-0.04 0"
51
+ frictionloss="15" damping="10" armature="0.05" solreffriction="0.004 1"/>
52
+ <!-- shaft along x: from +0.03 (into wall) to -0.03 (sticking toward robot) -->
53
+ <geom name="nail_shaft" type="cylinder" fromto="0.03 0 0 -0.03 0 0" size="0.003"
54
+ density="7850" contype="0" conaffinity="0" rgba="0.72 0.72 0.75 1"/>
55
+ <!-- head: a disk at the robot-facing (-x) end; the hammer strike surface -->
56
+ <geom name="nail_head" type="cylinder" fromto="-0.03 0 0 -0.035 0 0" size="0.009"
57
+ density="7850" solref="0.004 1" solimp="0.9 0.95 0.001" rgba="0.70 0.70 0.74 1"/>
58
+ </body>
59
+ </body>
60
+ </worldbody>
61
+ </mujoco>
assets/local_hammer_nail/textures/wall_brick.png ADDED

Git LFS Details

  • SHA256: 501e43965f7fbd6f1b124bdaeb7607e6b62f56e0367c60d63d5ada7e905d62d7
  • Pointer size: 132 Bytes
  • Size of remote file: 2.15 MB
assets/local_hammer_nail/usd/board_nail.usd CHANGED
Binary files a/assets/local_hammer_nail/usd/board_nail.usd and b/assets/local_hammer_nail/usd/board_nail.usd differ
 
assets/local_hammer_nail/usd/board_nail_wall.usd ADDED
Binary file (5.44 kB). View file
 
assets/local_hammer_nail/usd/configuration/board_nail_wall_base.usd ADDED
Binary file (2.23 kB). View file
 
assets/local_hammer_nail/usd/configuration/board_nail_wall_physics.usd ADDED
Binary file (2.76 kB). View file
 
assets/local_hammer_nail/usd/configuration/board_nail_wall_robot.usd ADDED
Binary file (1.32 kB). View file
 
assets/local_hammer_nail/usd/configuration/board_nail_wall_sensor.usd ADDED
Binary file (655 Bytes). View file