Passing different arguments to a yaml configuration file

asked 2019-12-10 09:47:06 -0500

Patrick Musau gravatar image

I have a general question about passing substitution arguments to your .yaml file. One of the things I'm having trouble with is passing different arguments to the yaml file. So the first time I pass the argument $(arg control_name) to the yaml file and it works. The second time lets say I want to pass the argument $(arg control_name_2) to it, it doesn't work.

I tried defining the argument within the rosparam tags but that didn't work either. Kindly an example of how I'm doing this below. Thanks for your help!

<arg name="control_name" value="racecar3" /> <rosparam file="$(find racecar_control)/config/racecar_control_gen.yaml" subst_value="true" command="load">$(arg control_name)</rosparam>

 $(arg control_name):
  # Publish all joint states -----------------------------------
  joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 50


  # Velocity Controllers ---------------------------------------
  left_rear_wheel_velocity_controller:
    type: effort_controllers/JointVelocityController
    joint: left_rear_wheel_joint
    pid: {p: 1.0, i: 0.0, d: 0.0, i_clamp: 0.0}
  right_rear_wheel_velocity_controller:
    type: effort_controllers/JointVelocityController
    joint: right_rear_wheel_joint
    pid: {p: 1.0, i: 0.0, d: 0.0, i_clamp: 0.0}
  left_front_wheel_velocity_controller:
    type: effort_controllers/JointVelocityController
    joint: left_front_wheel_joint
    pid: {p: 0.5, i: 0.0, d: 0.0, i_clamp: 0.0}
  right_front_wheel_velocity_controller:
    type: effort_controllers/JointVelocityController
    joint: right_front_wheel_joint
    pid: {p: 0.5, i: 0.0, d: 0.0, i_clamp: 0.0}


  # Position Controllers ---------------------------------------
  left_steering_hinge_position_controller:
    joint: left_steering_hinge_joint
    type: effort_controllers/JointPositionController
    pid: {p: 10.0, i: 0.0, d: 0.5}
  right_steering_hinge_position_controller:
    joint: right_steering_hinge_joint
    type: effort_controllers/JointPositionController
    pid: {p: 10.0, i: 0.0, d: 0.5}
edit retag flag offensive close merge delete