Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spawner.py parse parameters with namespace wrong #1506

Closed
delihus opened this issue Apr 25, 2024 · 2 comments · Fixed by #1640
Closed

spawner.py parse parameters with namespace wrong #1506

delihus opened this issue Apr 25, 2024 · 2 comments · Fixed by #1640
Labels

Comments

@delihus
Copy link

delihus commented Apr 25, 2024

Describe the bug
Using spawner.py with --params-file and --namespace doesn't work properly.

To Reproduce
Steps to reproduce the behavior:

  1. Launch controller manager with namespace panther

  2. Take this file:

/**:
  controller_manager:
    ros__parameters:
      update_rate: 500  # Hz

      joint_state_broadcaster:
        type: joint_state_broadcaster/JointStateBroadcaster

      io_and_status_controller:
        type: ur_controllers/GPIOController

      speed_scaling_state_broadcaster:
        type: ur_controllers/SpeedScalingStateBroadcaster

      force_torque_sensor_broadcaster:
        type: ur_controllers/ForceTorqueStateBroadcaster

      joint_trajectory_controller:
        type: joint_trajectory_controller/JointTrajectoryController

      scaled_joint_trajectory_controller:
        type: ur_controllers/ScaledJointTrajectoryController

      forward_velocity_controller:
        type: velocity_controllers/JointGroupVelocityController

      forward_position_controller:
        type: position_controllers/JointGroupPositionController


  speed_scaling_state_broadcaster:
    ros__parameters:
      state_publish_rate: 100.0


  force_torque_sensor_broadcaster:
    ros__parameters:
      sensor_name: tcp_fts_sensor
      state_interface_names:
        - force.x
        - force.y
        - force.z
        - torque.x
        - torque.y
        - torque.z
      frame_id: tool0
      topic_name: ft_data


  joint_trajectory_controller:
    ros__parameters:
      joints:
        - shoulder_pan_joint
        - shoulder_lift_joint
        - elbow_joint
        - wrist_1_joint
        - wrist_2_joint
        - wrist_3_joint
      command_interfaces:
        - position
      state_interfaces:
        - position
        - velocity
      state_publish_rate: 100.0
      action_monitor_rate: 20.0
      allow_partial_joints_goal: false
      constraints:
        stopped_velocity_tolerance: 0.2
        goal_time: 0.0
        shoulder_pan_joint: { trajectory: 0.2, goal: 0.1 }
        shoulder_lift_joint: { trajectory: 0.2, goal: 0.1 }
        elbow_joint: { trajectory: 0.2, goal: 0.1 }
        wrist_1_joint: { trajectory: 0.2, goal: 0.1 }
        wrist_2_joint: { trajectory: 0.2, goal: 0.1 }
        wrist_3_joint: { trajectory: 0.2, goal: 0.1 }


  scaled_joint_trajectory_controller:
    ros__parameters:
      joints:
        - shoulder_pan_joint
        - shoulder_lift_joint
        - elbow_joint
        - wrist_1_joint
        - wrist_2_joint
        - wrist_3_joint
      command_interfaces:
        - position
      state_interfaces:
        - position
        - velocity
      state_publish_rate: 100.0
      action_monitor_rate: 20.0
      allow_partial_joints_goal: false
      constraints:
        stopped_velocity_tolerance: 0.2
        goal_time: 0.0
        shoulder_pan_joint: { trajectory: 0.2, goal: 0.1 }
        shoulder_lift_joint: { trajectory: 0.2, goal: 0.1 }
        elbow_joint: { trajectory: 0.2, goal: 0.1 }
        wrist_1_joint: { trajectory: 0.2, goal: 0.1 }
        wrist_2_joint: { trajectory: 0.2, goal: 0.1 }
        wrist_3_joint: { trajectory: 0.2, goal: 0.1 }

  forward_velocity_controller:
    ros__parameters:
      joints:
        - shoulder_pan_joint
        - shoulder_lift_joint
        - elbow_joint
        - wrist_1_joint
        - wrist_2_joint
        - wrist_3_joint
      interface_name: velocity

  forward_position_controller:
    ros__parameters:
      joints:
        - shoulder_pan_joint
        - shoulder_lift_joint
        - elbow_joint
        - wrist_1_joint
        - wrist_2_joint
        - wrist_3_joint

  1. Save it to /tmp/jtc.yaml

  2. Spawn JTC:

python3 spawner.py  joint_trajectory_controller -c controller_manager --controller-manager-timeout 10 --namespace panther --param-file /tmp/jtc.yaml --ros-args -r __ns:=/panther -p use_sim_time:=True
  1. See error:
/home/deli/Documents/panther_dev/spawner.py:401: DeprecationWarning: 'spawner.py' is deprecated, please use 'spawner' (without .py extension)
[INFO] [1714054504.062935319] [panther.spawner_joint_trajectory_controller]: Set controller params file to "/tmp/jtc.yaml" for panther/joint_trajectory_controller
[FATAL] [1714054504.064816747] [panther.spawner_joint_trajectory_controller]: Failed loading controller panther/joint_trajectory_controller

Expected behavior
JTC should be configured correctly ans spawner.py should correctly parse parameters.

Screenshots
The red is wrong parameter. The green is good after this fix:
https://github.com/ros-controls/ros2_control/blob/humble/controller_manager/controller_manager/spawner.py#L272
FROM:

parameter.name = prefixed_controller_name + ".params_file"

TO:

parameter.name = controller_name + ".params_file"

image

ERROR
image
Environment (please complete the following information):

  • OS: ubuntu 22.04
  • Version humble
@christophfroehlich
Copy link
Contributor

It seems that you have already found a fix, would you mind creating a PR for this?

@delihus
Copy link
Author

delihus commented May 23, 2024

@christophfroehlich Created PR #1547

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants