diff --git a/urc_arm/config/controller_config.yaml b/urc_arm/config/controller_config.yaml index e69de29b..4984b888 100644 --- a/urc_arm/config/controller_config.yaml +++ b/urc_arm/config/controller_config.yaml @@ -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" diff --git a/urc_arm/launch/mjsim.launch.py b/urc_arm/launch/mjsim.launch.py index 30f7d76f..7a3c7234 100644 --- a/urc_arm/launch/mjsim.launch.py +++ b/urc_arm/launch/mjsim.launch.py @@ -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", diff --git a/urc_arm_py/urc_arm_py/arm_sim_mj.py b/urc_arm_py/urc_arm_py/arm_sim_mj.py index ee84082f..41e8c858 100644 --- a/urc_arm_py/urc_arm_py/arm_sim_mj.py +++ b/urc_arm_py/urc_arm_py/arm_sim_mj.py @@ -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