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

F parameterise using local hardware interface param #110

Conversation

carebare47
Copy link
Contributor

In it's current form, this driver won't allow multiple arms to exist in the same namespace. This pr fixes that by adding a parameter that allows the hardware_interface/joints parameter to be loaded from the drivers local namespace instead of the global one.

@gavanderhoorn
Copy link
Contributor

Aren't these parameter lookups relative to the "current namespace" already?

@carebare47
Copy link
Contributor Author

carebare47 commented Feb 14, 2020

Aren't these parameter lookups relative to the "current namespace" already?

Most are, but not this one:

if (!root_nh.getParam("hardware_interface/joints", joint_names_))

The rest use

robot_hw_nh

@gavanderhoorn
Copy link
Contributor

Then I would propose to rectify that, instead of adding a parameter.

@fmauch: opinion?

@fmauch
Copy link
Collaborator

fmauch commented Feb 17, 2020

This handle is indeed not a global one but should be namespaced, as well. It lives on the same level as the controllers. If the driver is not namespaced, it is equivalent of the global namespace.

Running the driver with a namespace yields

$ ROS_NAMESPACE=my_driver roslaunch ur_robot_driver ur10e_bringup.launch robot_ip:=192.168.56.101                                                                                                                                                                            
... logging to /home/mauch/.ros/log/7b587fdc-515b-11ea-92b1-54ee755e8d52/roslaunch-ids-abam-13777.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt

started roslaunch server http://ids-abam:35597/

SUMMARY
========

PARAMETERS
 * /my_driver/controller_stopper/consistent_controllers: ['joint_state_con...
 * /my_driver/force_torque_sensor_controller/publish_rate: 500
 * /my_driver/force_torque_sensor_controller/type: force_torque_sens...
 * /my_driver/hardware_control_loop/loop_hz: 500
 * /my_driver/hardware_interface/joints: ['shoulder_pan_jo...
 * /my_driver/joint_group_vel_controller/joints: ['shoulder_pan_jo...
 * /my_driver/joint_group_vel_controller/type: velocity_controll...
 * /my_driver/joint_state_controller/publish_rate: 500
 * /my_driver/joint_state_controller/type: joint_state_contr...
 * /my_driver/pos_traj_controller/action_monitor_rate: 10
 * /my_driver/pos_traj_controller/constraints/elbow_joint/goal: 0.1
 * /my_driver/pos_traj_controller/constraints/elbow_joint/trajectory: 0.2
 * /my_driver/pos_traj_controller/constraints/goal_time: 0.6
 * /my_driver/pos_traj_controller/constraints/shoulder_lift_joint/goal: 0.1
 * /my_driver/pos_traj_controller/constraints/shoulder_lift_joint/trajectory: 0.2
 * /my_driver/pos_traj_controller/constraints/shoulder_pan_joint/goal: 0.1
 * /my_driver/pos_traj_controller/constraints/shoulder_pan_joint/trajectory: 0.2
 * /my_driver/pos_traj_controller/constraints/stopped_velocity_tolerance: 0.05
 * /my_driver/pos_traj_controller/constraints/wrist_1_joint/goal: 0.1
 * /my_driver/pos_traj_controller/constraints/wrist_1_joint/trajectory: 0.2
 * /my_driver/pos_traj_controller/constraints/wrist_2_joint/goal: 0.1
 * /my_driver/pos_traj_controller/constraints/wrist_2_joint/trajectory: 0.2
 * /my_driver/pos_traj_controller/constraints/wrist_3_joint/goal: 0.1
 * /my_driver/pos_traj_controller/constraints/wrist_3_joint/trajectory: 0.2
 * /my_driver/pos_traj_controller/joints: ['shoulder_pan_jo...
 * /my_driver/pos_traj_controller/state_publish_rate: 500
 * /my_driver/pos_traj_controller/stop_trajectory_duration: 0.5
 * /my_driver/pos_traj_controller/type: position_controll...
 * /my_driver/robot_description: <?xml version="1....
 * /my_driver/scaled_pos_traj_controller/action_monitor_rate: 10
 * /my_driver/scaled_pos_traj_controller/constraints/elbow_joint/goal: 0.1
 * /my_driver/scaled_pos_traj_controller/constraints/elbow_joint/trajectory: 0.2
 * /my_driver/scaled_pos_traj_controller/constraints/goal_time: 0.6
 * /my_driver/scaled_pos_traj_controller/constraints/shoulder_lift_joint/goal: 0.1
 * /my_driver/scaled_pos_traj_controller/constraints/shoulder_lift_joint/trajectory: 0.2
 * /my_driver/scaled_pos_traj_controller/constraints/shoulder_pan_joint/goal: 0.1
 * /my_driver/scaled_pos_traj_controller/constraints/shoulder_pan_joint/trajectory: 0.2
 * /my_driver/scaled_pos_traj_controller/constraints/stopped_velocity_tolerance: 0.05
 * /my_driver/scaled_pos_traj_controller/constraints/wrist_1_joint/goal: 0.1
 * /my_driver/scaled_pos_traj_controller/constraints/wrist_1_joint/trajectory: 0.2
 * /my_driver/scaled_pos_traj_controller/constraints/wrist_2_joint/goal: 0.1
 * /my_driver/scaled_pos_traj_controller/constraints/wrist_2_joint/trajectory: 0.2
 * /my_driver/scaled_pos_traj_controller/constraints/wrist_3_joint/goal: 0.1
 * /my_driver/scaled_pos_traj_controller/constraints/wrist_3_joint/trajectory: 0.2
 * /my_driver/scaled_pos_traj_controller/joints: ['shoulder_pan_jo...
 * /my_driver/scaled_pos_traj_controller/state_publish_rate: 500
 * /my_driver/scaled_pos_traj_controller/stop_trajectory_duration: 0.5
 * /my_driver/scaled_pos_traj_controller/type: position_controll...
 * /my_driver/scaled_vel_traj_controller/action_monitor_rate: 10
 * /my_driver/scaled_vel_traj_controller/constraints/elbow_joint/goal: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/elbow_joint/trajectory: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/goal_time: 0.6
 * /my_driver/scaled_vel_traj_controller/constraints/shoulder_lift_joint/goal: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/shoulder_lift_joint/trajectory: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/shoulder_pan_joint/goal: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/shoulder_pan_joint/trajectory: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/stopped_velocity_tolerance: 0.05
 * /my_driver/scaled_vel_traj_controller/constraints/wrist_1_joint/goal: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/wrist_1_joint/trajectory: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/wrist_2_joint/goal: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/wrist_2_joint/trajectory: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/wrist_3_joint/goal: 0.1
 * /my_driver/scaled_vel_traj_controller/constraints/wrist_3_joint/trajectory: 0.1
 * /my_driver/scaled_vel_traj_controller/gains/elbow_joint/d: 0.1
 * /my_driver/scaled_vel_traj_controller/gains/elbow_joint/i: 0.05
 * /my_driver/scaled_vel_traj_controller/gains/elbow_joint/i_clamp: 1
 * /my_driver/scaled_vel_traj_controller/gains/elbow_joint/p: 5.0
 * /my_driver/scaled_vel_traj_controller/gains/shoulder_lift_joint/d: 0.1
 * /my_driver/scaled_vel_traj_controller/gains/shoulder_lift_joint/i: 0.05
 * /my_driver/scaled_vel_traj_controller/gains/shoulder_lift_joint/i_clamp: 1
 * /my_driver/scaled_vel_traj_controller/gains/shoulder_lift_joint/p: 5.0
 * /my_driver/scaled_vel_traj_controller/gains/shoulder_pan_joint/d: 0.1
 * /my_driver/scaled_vel_traj_controller/gains/shoulder_pan_joint/i: 0.05
 * /my_driver/scaled_vel_traj_controller/gains/shoulder_pan_joint/i_clamp: 1
 * /my_driver/scaled_vel_traj_controller/gains/shoulder_pan_joint/p: 5.0
 * /my_driver/scaled_vel_traj_controller/gains/wrist_1_joint/d: 0.1
 * /my_driver/scaled_vel_traj_controller/gains/wrist_1_joint/i: 0.05
 * /my_driver/scaled_vel_traj_controller/gains/wrist_1_joint/i_clamp: 1
 * /my_driver/scaled_vel_traj_controller/gains/wrist_1_joint/p: 5.0
 * /my_driver/scaled_vel_traj_controller/gains/wrist_2_joint/d: 0.1
 * /my_driver/scaled_vel_traj_controller/gains/wrist_2_joint/i: 0.05
 * /my_driver/scaled_vel_traj_controller/gains/wrist_2_joint/i_clamp: 1
 * /my_driver/scaled_vel_traj_controller/gains/wrist_2_joint/p: 5.0
 * /my_driver/scaled_vel_traj_controller/gains/wrist_3_joint/d: 0.1
 * /my_driver/scaled_vel_traj_controller/gains/wrist_3_joint/i: 0.05
 * /my_driver/scaled_vel_traj_controller/gains/wrist_3_joint/i_clamp: 1
 * /my_driver/scaled_vel_traj_controller/gains/wrist_3_joint/p: 5.0
 * /my_driver/scaled_vel_traj_controller/joints: ['shoulder_pan_jo...
 * /my_driver/scaled_vel_traj_controller/state_publish_rate: 500
 * /my_driver/scaled_vel_traj_controller/stop_trajectory_duration: 0.5
 * /my_driver/scaled_vel_traj_controller/type: velocity_controll...
 * /my_driver/scaled_vel_traj_controller/velocity_ff/elbow_joint: 1.0
 * /my_driver/scaled_vel_traj_controller/velocity_ff/shoulder_lift_joint: 1.0
 * /my_driver/scaled_vel_traj_controller/velocity_ff/shoulder_pan_joint: 1.0
 * /my_driver/scaled_vel_traj_controller/velocity_ff/wrist_1_joint: 1.0
 * /my_driver/scaled_vel_traj_controller/velocity_ff/wrist_2_joint: 1.0
 * /my_driver/scaled_vel_traj_controller/velocity_ff/wrist_3_joint: 1.0
 * /my_driver/speed_scaling_state_controller/publish_rate: 500
 * /my_driver/speed_scaling_state_controller/type: ur_controllers/Sp...
 * /my_driver/ur_hardware_interface/headless_mode: False
 * /my_driver/ur_hardware_interface/input_recipe_file: /home/mauch/robot...
 * /my_driver/ur_hardware_interface/kinematics/forearm/pitch: 0
 * /my_driver/ur_hardware_interface/kinematics/forearm/roll: 0
 * /my_driver/ur_hardware_interface/kinematics/forearm/x: -0.6127
 * /my_driver/ur_hardware_interface/kinematics/forearm/y: 0
 * /my_driver/ur_hardware_interface/kinematics/forearm/yaw: 0
 * /my_driver/ur_hardware_interface/kinematics/forearm/z: 0
 * /my_driver/ur_hardware_interface/kinematics/hash: calib_51197013707...
 * /my_driver/ur_hardware_interface/kinematics/shoulder/pitch: 0
 * /my_driver/ur_hardware_interface/kinematics/shoulder/roll: 0
 * /my_driver/ur_hardware_interface/kinematics/shoulder/x: 0
 * /my_driver/ur_hardware_interface/kinematics/shoulder/y: 0
 * /my_driver/ur_hardware_interface/kinematics/shoulder/yaw: 0
 * /my_driver/ur_hardware_interface/kinematics/shoulder/z: 0.1807
 * /my_driver/ur_hardware_interface/kinematics/upper_arm/pitch: 0
 * /my_driver/ur_hardware_interface/kinematics/upper_arm/roll: 1.570796327
 * /my_driver/ur_hardware_interface/kinematics/upper_arm/x: 0
 * /my_driver/ur_hardware_interface/kinematics/upper_arm/y: 0
 * /my_driver/ur_hardware_interface/kinematics/upper_arm/yaw: 0
 * /my_driver/ur_hardware_interface/kinematics/upper_arm/z: 0
 * /my_driver/ur_hardware_interface/kinematics/wrist_1/pitch: 0
 * /my_driver/ur_hardware_interface/kinematics/wrist_1/roll: 0
 * /my_driver/ur_hardware_interface/kinematics/wrist_1/x: -0.57155
 * /my_driver/ur_hardware_interface/kinematics/wrist_1/y: 0
 * /my_driver/ur_hardware_interface/kinematics/wrist_1/yaw: 0
 * /my_driver/ur_hardware_interface/kinematics/wrist_1/z: 0.17415
 * /my_driver/ur_hardware_interface/kinematics/wrist_2/pitch: 0
 * /my_driver/ur_hardware_interface/kinematics/wrist_2/roll: 1.570796327
 * /my_driver/ur_hardware_interface/kinematics/wrist_2/x: 0
 * /my_driver/ur_hardware_interface/kinematics/wrist_2/y: -0.11985
 * /my_driver/ur_hardware_interface/kinematics/wrist_2/yaw: 0
 * /my_driver/ur_hardware_interface/kinematics/wrist_2/z: -2.45816459076e-11
 * /my_driver/ur_hardware_interface/kinematics/wrist_3/pitch: 3.14159265359
 * /my_driver/ur_hardware_interface/kinematics/wrist_3/roll: 1.57079632659
 * /my_driver/ur_hardware_interface/kinematics/wrist_3/x: 0
 * /my_driver/ur_hardware_interface/kinematics/wrist_3/y: 0.11655
 * /my_driver/ur_hardware_interface/kinematics/wrist_3/yaw: 3.14159265359
 * /my_driver/ur_hardware_interface/kinematics/wrist_3/z: -2.39048045935e-11
 * /my_driver/ur_hardware_interface/output_recipe_file: /home/mauch/robot...
 * /my_driver/ur_hardware_interface/reverse_port: 50001
 * /my_driver/ur_hardware_interface/robot_ip: 192.168.56.101
 * /my_driver/ur_hardware_interface/script_file: /home/mauch/robot...
 * /my_driver/ur_hardware_interface/script_sender_port: 50002
 * /my_driver/ur_hardware_interface/tf_prefix: 
 * /my_driver/ur_hardware_interface/tool_baud_rate: 115200
 * /my_driver/ur_hardware_interface/tool_parity: 0
 * /my_driver/ur_hardware_interface/tool_rx_idle_chars: 1.5
 * /my_driver/ur_hardware_interface/tool_stop_bits: 1
 * /my_driver/ur_hardware_interface/tool_tx_idle_chars: 3.5
 * /my_driver/ur_hardware_interface/tool_voltage: 0
 * /my_driver/ur_hardware_interface/use_tool_communication: False
 * /my_driver/vel_traj_controller/action_monitor_rate: 10
 * /my_driver/vel_traj_controller/constraints/elbow_joint/goal: 0.1
 * /my_driver/vel_traj_controller/constraints/elbow_joint/trajectory: 0.1
 * /my_driver/vel_traj_controller/constraints/goal_time: 0.6
 * /my_driver/vel_traj_controller/constraints/shoulder_lift_joint/goal: 0.1
 * /my_driver/vel_traj_controller/constraints/shoulder_lift_joint/trajectory: 0.1
 * /my_driver/vel_traj_controller/constraints/shoulder_pan_joint/goal: 0.1
 * /my_driver/vel_traj_controller/constraints/shoulder_pan_joint/trajectory: 0.1
 * /my_driver/vel_traj_controller/constraints/stopped_velocity_tolerance: 0.05
 * /my_driver/vel_traj_controller/constraints/wrist_1_joint/goal: 0.1
 * /my_driver/vel_traj_controller/constraints/wrist_1_joint/trajectory: 0.1
 * /my_driver/vel_traj_controller/constraints/wrist_2_joint/goal: 0.1
 * /my_driver/vel_traj_controller/constraints/wrist_2_joint/trajectory: 0.1
 * /my_driver/vel_traj_controller/constraints/wrist_3_joint/goal: 0.1
 * /my_driver/vel_traj_controller/constraints/wrist_3_joint/trajectory: 0.1
 * /my_driver/vel_traj_controller/gains/elbow_joint/d: 0.1
 * /my_driver/vel_traj_controller/gains/elbow_joint/i: 0.05
 * /my_driver/vel_traj_controller/gains/elbow_joint/i_clamp: 1
 * /my_driver/vel_traj_controller/gains/elbow_joint/p: 5.0
 * /my_driver/vel_traj_controller/gains/shoulder_lift_joint/d: 0.1
 * /my_driver/vel_traj_controller/gains/shoulder_lift_joint/i: 0.05
 * /my_driver/vel_traj_controller/gains/shoulder_lift_joint/i_clamp: 1
 * /my_driver/vel_traj_controller/gains/shoulder_lift_joint/p: 5.0
 * /my_driver/vel_traj_controller/gains/shoulder_pan_joint/d: 0.1
 * /my_driver/vel_traj_controller/gains/shoulder_pan_joint/i: 0.05
 * /my_driver/vel_traj_controller/gains/shoulder_pan_joint/i_clamp: 1
 * /my_driver/vel_traj_controller/gains/shoulder_pan_joint/p: 5.0
 * /my_driver/vel_traj_controller/gains/wrist_1_joint/d: 0.1
 * /my_driver/vel_traj_controller/gains/wrist_1_joint/i: 0.05
 * /my_driver/vel_traj_controller/gains/wrist_1_joint/i_clamp: 1
 * /my_driver/vel_traj_controller/gains/wrist_1_joint/p: 5.0
 * /my_driver/vel_traj_controller/gains/wrist_2_joint/d: 0.1
 * /my_driver/vel_traj_controller/gains/wrist_2_joint/i: 0.05
 * /my_driver/vel_traj_controller/gains/wrist_2_joint/i_clamp: 1
 * /my_driver/vel_traj_controller/gains/wrist_2_joint/p: 5.0
 * /my_driver/vel_traj_controller/gains/wrist_3_joint/d: 0.1
 * /my_driver/vel_traj_controller/gains/wrist_3_joint/i: 0.05
 * /my_driver/vel_traj_controller/gains/wrist_3_joint/i_clamp: 1
 * /my_driver/vel_traj_controller/gains/wrist_3_joint/p: 5.0
 * /my_driver/vel_traj_controller/joints: ['shoulder_pan_jo...
 * /my_driver/vel_traj_controller/state_publish_rate: 500
 * /my_driver/vel_traj_controller/stop_trajectory_duration: 0.5
 * /my_driver/vel_traj_controller/type: velocity_controll...
 * /my_driver/vel_traj_controller/velocity_ff/elbow_joint: 1.0
 * /my_driver/vel_traj_controller/velocity_ff/shoulder_lift_joint: 1.0
 * /my_driver/vel_traj_controller/velocity_ff/shoulder_pan_joint: 1.0
 * /my_driver/vel_traj_controller/velocity_ff/wrist_1_joint: 1.0
 * /my_driver/vel_traj_controller/velocity_ff/wrist_2_joint: 1.0
 * /my_driver/vel_traj_controller/velocity_ff/wrist_3_joint: 1.0
 * /rosdistro: melodic
 * /rosversion: 1.14.3

From my point of view this is intended, but of course, we can discuss that. Adding a separate parameter for this also seems not the right way of doing this to me.

@gavanderhoorn
Copy link
Contributor

This handle is indeed not a global one but should be namespaced, as well. It lives on the same level as the controllers. If the driver is not namespaced, it is equivalent of the global namespace.

This is indeed what I also had understood, and tried to convey with my not too articulate comment above.

@toliver
Copy link

toliver commented Feb 17, 2020

Hi, what we forgot to mention is that we are running a multiple arm configuration using CombinedRobotHw. Therefore both arms' RobotHw's are running in the same process.

That's why we want to add the option to read the joint list from the local configuration of each RobotHw (robot_hw_nh), instead of from the top level of the node (root_nh).

The new parameter defaults to the previous behaviour, so no one would notice any difference.

This would ensure compatibility of this driver with CombinedRobotHw.

@gavanderhoorn
Copy link
Contributor

I believe it'd be still nicer to just use robot_hw_nh instead of root_nh.

Adding a parameter for this seems really undesirable.

@toliver
Copy link

toliver commented Feb 17, 2020

Using robot_hw_nh instead of root_nh would work in our use case, but I'm not sure if it would break yours?

Currently you are expecting to read hardware_interface/joints from the top level, whereas all the other parameters are local to the node.

Would you then expect to change the way hardware_interface/joints is defined and make it local to the node as well? (Which is how we are doing it).

@fmauch
Copy link
Collaborator

fmauch commented Feb 17, 2020

Then we would have to create a second yaml file containing only the joint names. We could load this into the robot_hw_nh's namespace in the ur_control.launch file and read it from there inside the HardwareInterface.

Then, someone changing the robot's joint names will have to adapt both files (the joint_names file and the controllers.yaml file)

@toliver
Copy link

toliver commented Feb 18, 2020

That sounds good.
Should we include the yaml changes in this PR as well, or would you prefer to create a separate PR for that yourself?

@gavanderhoorn
Copy link
Contributor

I'm not entirely sure we need to .yaml files. If we do that, we'd lose the ability to use anchors and references.

@fmauch
Copy link
Collaborator

fmauch commented Feb 18, 2020

I'm not entirely sure we need to .yaml files. If we do that, we'd lose the ability to use anchors and references.

But if we keep it in the same .yaml file, we need to know the node's name to load it into its private namespace, right? Or is ist possible to load all the controller's parameters into the private namespace? Then, that would conflict with the combined hw case again if I'm not mistaken. (And also move the controllers into the node's private namespace)

@toliver
Copy link

toliver commented Feb 18, 2020

Or is ist possible to load all the controller's parameters into the private namespace? Then, that would conflict with the combined hw case again if I'm not mistaken.

Yes, that would conflict with the combined_robot_hw use case. In that case the controller parameters are loaded in the top level, as there is only one controller manager. A certain controller can control resources belonging to different underlying RobotHw components.

Another small difference in the combined use case is that robot_hw_nh doesn't point to the node namespace (e.g. /ur_hardware_interface), but to the namespace of the particular RobotHw (e.g. /ur_hardware_interface/right_ur10). As you can see here and here. But this should not make any difference form the RobotHw point of view, it's just a question of arranging the parameters according to the use case.

@toliver
Copy link

toliver commented Mar 2, 2020

@fmauch @gavanderhoorn I think this is pending a decision on your side. Could we resume the discussion?

@carebare47
Copy link
Contributor Author

Hi @fmauch @gavanderhoorn , have either of you had any further thoughts on this?

@fmauch
Copy link
Collaborator

fmauch commented Jun 24, 2020

Sorry, I am still not fully convinced and also with #198 I don't want to rush anything there. Adding a parameter for this seems awkward to me. I'd rather raise the question whether it has to be the root_ns in the first place which brings me back to my previous arguments.

@fmauch
Copy link
Collaborator

fmauch commented Aug 21, 2020

Closing, as #227 got merged.

@fmauch fmauch closed this Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants