fzi-forschungszentrum-informatik / cartesian_controllers

A set of Cartesian controllers for the ROS1 and ROS2-control framework.
BSD 3-Clause "New" or "Revised" License
397 stars 118 forks source link

feat: topic names as node parameters #197

Closed MarcoMagriDev closed 5 months ago

MarcoMagriDev commented 6 months ago

There might be situations in which the launch file in which the controller_manager node is started is not directly accessible thus making impossible for the user to define topic names for the controllers (as far as I understood it must be done via remappings on the node but correct me if I am wrong).

This PR defines and expose parameters for each topic name so that they can configured by means of the controllers.yaml file. Note that, default values of those params still matches the original one so, if not specified by the user, the original behavior is preserved.

firesurfer commented 6 months ago

@MarcoMagriDev As far as I am aware it is advised not to have configurable topic names in ROS nodes. As you said you should use topic remappings which is also possible to do for ros2 control controllers in your launch file.

For example like this

 start_control_node_cmd = Node(
        package="controller_manager",
        executable="ros2_control_node",
        parameters=[robot_description_parameter, controller_config_file],
        output="both",
        emulate_tty=True,
        remappings=[
            (
                "cartesian_compliance_controller_bottom/ft_sensor_wrench",
                "/force_torque_sensor_broadcaster_bottom/wrench",
            ),
        ])
stefanscherzinger commented 5 months ago

Yes, I agree with @firesurfer on this. Using topic remappings is the way to go. Thanks @MarcoMagriDev for the effort, though!