PickNikRobotics / ros_control_boilerplate

Provides a simple simulation interface and template for setting up a hardware interface for ros_control
BSD 3-Clause "New" or "Revised" License
244 stars 89 forks source link

commandline controller_manager command freezes #23

Open ptiza-v-nebe opened 5 years ago

ptiza-v-nebe commented 5 years ago

First I just run: roslaunch ros_control_boilerplate rrbot_simulation.launch

Now I'm trying to list all available controllers with: rosrun controller_manager controller_manager list

It freezes, nothing happens, no error, no nothing until ctrl-c

The same operation with ros services do the job well: rosservice call /rrbot/controller_manager/list_controllers

Return of service call:

controller: 
  - 
    name: "joint_state_controller"
    state: "running"
    type: "joint_state_controller/JointStateController"
    claimed_resources: 
      - 
        hardware_interface: "hardware_interface::JointStateInterface"
        resources: []
  - 
    name: "position_trajectory_controller"
    state: "running"
    type: "position_controllers/JointTrajectoryController"
    claimed_resources: 
      - 
        hardware_interface: "hardware_interface::PositionJointInterface"
        resources: [joint1, joint2]

Now in the search for solution I found that custom namespaces do maybe something wrong. If I go to rrbot_simulation.launch and change this:

...
<group ns="/rrbot">

    <!-- Load hardware interface -->
    <node name="rrbot_hardware_interface" pkg="ros_control_boilerplate" type="sim_hw_main"
          output="screen" launch-pref...

Into this:

...
<group>

    <!-- Load hardware interface -->
    <node name="rrbot_hardware_interface" pkg="ros_control_boilerplate" type="sim_hw_main"
          output="screen" launch-pref...

it works well.

If anyway need a custom namespace then use something like this:

...
    <node name="ros_control_controller_manager" pkg="controller_manager" type="controller_manager" respawn="false"
      output="screen" args="spawn /rrbot/joint_state_controller /rrbot/position_trajectory_controller" />
...

This sounding all a little bit like tutorial but no, this is a question. Do I'm something wrong or is the behavior above, a bug or feature or what else??

Same issue and ros_control_boilerplate, with same commandline controller_manager freezing behaviour, are mentioned here: https://answers.ros.org/question/284099/controller-spawner-stuck-while-loading/

Thank you!

rickstaa commented 3 years ago

@ptiza-v-nebe I stumbled upon this issue by accident, but let me answer it for future reference. The problems you're experiencing is that by default, the controller manager script looks for controllers under the base namespace (i.e., /). In your case, the robot controller_maneger is found under the /rrbot namespace. It looks like the controller_manager unfortunately doesn't throw a warning when this happens, but waits till controllers are found. When this happens you have to change the ROS_NAMESPACE for the controller_manager to find your controllers. This is done by setting the ROS_NAMESPACE environmental variable:

export ROS_NAMESPACE=/rrbot
Sofiap91 commented 2 years ago

@ptiza-v-nebe I stumbled upon this issue by accident, but let me answer it for future reference. The problems you're experiencing is that by default, the controller manager script looks for controllers under the base namespace (i.e., /). In your case, the robot controller_maneger is found under the /rrbot namespace. It looks like the controller_manager unfortunately doesn't throw a warning when this happens, but waits till controllers are found. When this happens you have to change the ROS_NAMESPACE for the controller_manager to find your controllers. This is done by setting the ROS_NAMESPACE environmental variable:

export ROS_NAMESPACE=/rrbot

Hi Rick. I was just wondering how should it be specified when you have more than one namespace, e.g., if you have two arms. Thank you!