Skip to content

Commit

Permalink
feat: update model dir config
Browse files Browse the repository at this point in the history
  • Loading branch information
KeseterG committed Nov 13, 2024
1 parent ef7e566 commit fac9089
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions urc_arm/config/controller_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arm_mj_sim:
ros__parameters:
model_dir: "/home/keseterg/Documents/RoboJackets/urc_ws/src/urc-software/urc_arm_models/urdf/walli_arm_v2_block_mjcf/walli_arm_v2_block.xml"
6 changes: 5 additions & 1 deletion urc_arm/launch/mjsim.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

def generate_launch_description():
# mujoco simulator
mjsim = Node(package="urc_arm_py", executable="arm_sim_mj")
mjsim = Node(
package="urc_arm_py",
executable="arm_sim_mj",
parameters=[controller_config_file_dir],
)

control_node = Node(
package="controller_manager",
Expand Down
7 changes: 4 additions & 3 deletions urc_arm_py/urc_arm_py/arm_sim_mj.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ class MjSimNode(Node):
def __init__(self):
super().__init__("arm_mj_sim")

self.declare_parameter("model_dir", "")
model_dir = self.get_parameter("model_dir").get_parameter_value().string_value
self.get_logger().warn(f"Loading model from: {model_dir}")
# Load the MuJoCo model
self.model = mujoco.MjModel.from_xml_path(
"/home/keseterg/Documents/RoboJackets/urc_ws/src/urc-software/urc_arm_models/urdf/walli_arm_v2_block_mjcf/walli_arm_v2_block.xml"
)
self.model = mujoco.MjModel.from_xml_path(model_dir)
self.data = mujoco.MjData(self.model)

# Initialize GLFW
Expand Down

0 comments on commit fac9089

Please sign in to comment.