Skip to content

Commit d61f007

Browse files
committed
adding mjcf generation to standard clr_mujoco launch file
1 parent a66f8d9 commit d61f007

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"finger_v6": 0.05,
3+
"clr_base": 0.05,
4+
"grab_handle": 0.05,
5+
"simplified_hatch_4060_face": 0.05,
6+
"ivr_hatch_frame_no_left": 0.05,
7+
"hatch_4060_frame": 0.05,
8+
"bench_lid": 0.05
9+
}

clr_mujoco_config/launch/clr_mujoco.launch.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,49 @@
2020
from launch import LaunchDescription
2121
from chonkur_deploy.launch_helpers import include_launch_file
2222
from launch_ros.actions import Node
23+
from launch.substitutions import (
24+
Command,
25+
FindExecutable,
26+
PathJoinSubstitution,
27+
)
28+
from launch_ros.substitutions import (
29+
FindPackageShare,
30+
)
2331

2432

2533
def generate_launch_description():
2634

2735
declared_arguments = []
2836

29-
Node(
37+
clr_mujoco_package_name = "clr_mujoco_config"
38+
clr_mujoco_description_file = "clr_xacro.urdf"
39+
40+
mjcf_robot_description_content = Command(
41+
[
42+
PathJoinSubstitution([FindExecutable(name="xacro")]),
43+
" ",
44+
PathJoinSubstitution([FindPackageShare(clr_mujoco_package_name), "urdf", clr_mujoco_description_file]),
45+
# Grasp frames should not be converted to MJCF objects
46+
" add_grasp_push_frames:=false",
47+
" model_env:=true",
48+
]
49+
)
50+
51+
generate_mjcf = Node(
3052
package="mujoco_ros2_control",
3153
executable="robot_description_to_mjcf.sh",
3254
output="both",
3355
emulate_tty=True,
34-
arguments=["--publish_topic", "/mujoco_robot_description"],
56+
arguments=[
57+
"--publish_topic",
58+
"/mujoco_robot_description",
59+
"--robot_description",
60+
mjcf_robot_description_content,
61+
"--convert_stl_to_obj",
62+
"--asset_dir",
63+
# PathJoinSubstitution([FindPackageShare(clr_mujoco_package_name), "description", "assets"]),
64+
"/home/er4-user/ws/src/mjcf_data/assets",
65+
],
3566
)
3667

3768
clr_launch = include_launch_file(
@@ -63,4 +94,4 @@ def generate_launch_description():
6394
],
6495
)
6596

66-
return LaunchDescription(declared_arguments + [clr_launch, point_cloud_proc])
97+
return LaunchDescription(declared_arguments + [generate_mjcf, clr_launch, point_cloud_proc])

0 commit comments

Comments
 (0)