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

Failed to activate controller - joint_state_broadcaster and diffdrive_controller #81

Open
anuragroy2001 opened this issue Sep 12, 2024 · 12 comments
Assignees

Comments

@anuragroy2001
Copy link

anuragroy2001 commented Sep 12, 2024

Robot Model

Standard
ROS distro

Humble

Networking Configuration

Unknown

OS

Ubuntu 22.04

Built from source or installed?

Built from source

Package version

not sure

Expected behaviour

Should launch gazebo simulator and let me move the robot through the keyboard

Actual behaviour

Gazebo launches but cant use anything to move

Command used
ros2 launch turtlebot4_ignition_bringup turtlebot4_ignition.launch.py

@anuragroy2001
Copy link
Author

spawner-32] [INFO] [1726126627.879960764] [spawner_joint_state_broadcaster]: Loaded joint_state_broadcaster [ruby $(which ign) gazebo-1] [INFO] [1726126627.883165417] [controller_manager]: Configuring controller 'joint_state_broadcaster' [ruby $(which ign) gazebo-1] [INFO] [1726126627.883490512] [joint_state_broadcaster]: 'joints' or 'interfaces' parameter is empty. All available state interfaces will be published [ruby $(which ign) gazebo-1] [ERROR] [1726126632.895651088] [controller_manager]: Switch controller timed out after 5.000000 seconds! [spawner-32] [ERROR] [1726126632.897863114] [spawner_joint_state_broadcaster]: Failed to activate controller [ERROR] [spawner-32]: process has died [pid 71355, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_state_broadcaster -c controller_manager --ros-args -r __ns:=/']. [INFO] [spawner-46]: process started with pid [72187] [spawner-46] [INFO] [1726126633.320203930] [spawner_diffdrive_controller]: waiting for service /controller_manager/list_controllers to become available... [ruby $(which ign) gazebo-1] [INFO] [1726126634.078819296] [controller_manager]: Loading controller 'diffdrive_controller' [spawner-46] [INFO] [1726126634.162491993] [spawner_diffdrive_controller]: Loaded diffdrive_controller [ruby $(which ign) gazebo-1] [INFO] [1726126634.164698182] [controller_manager]: Configuring controller 'diffdrive_controller' [ruby $(which ign) gazebo-1] [ERROR] [1726126639.171874358] [controller_manager]: Switch controller timed out after 5.000000 seconds! [spawner-46] [ERROR] [1726126639.174520307] [spawner_diffdrive_controller]: Failed to activate controller [ERROR] [spawner-46]: process has died [pid 72187, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner diffdrive_controller -c controller_manager --ros-args -r __ns:=/ --params-file /opt/ros/humble/share/irobot_create_control/config/control.yaml'].

@JohannesH1998
Copy link

Same Problem here. i got it to work once with just retrying the command, but it would not work again with the same command.

Ubuntu: 22.04
ROS: Humble
Gazebo: Fortress

spawner-32] [ERROR] [1726758548.129574063] [spawner_joint_state_broadcaster]: Failed to activate controller

[ERROR] [spawner-32]: process has died [pid 3706, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_state_broadcaster -c controller_manager --ros-args -r __ns:=/'].

[INFO] [spawner-47]: process started with pid [4509]

[spawner-47] [INFO] [1726758548.879439345] [spawner_diffdrive_controller]: waiting for service /controller_manager/list_controllers to become available...

[ruby $(which ign) gazebo-1] [INFO] [1726758550.548382120] [controller_manager]: Loading controller 'diffdrive_controller'

[spawner-47] [INFO] [1726758550.581728758] [spawner_diffdrive_controller]: Loaded diffdrive_controller

[ruby $(which ign) gazebo-1] [INFO] [1726758550.583345119] [controller_manager]: Configuring controller 'diffdrive_controller'

[ruby $(which ign) gazebo-1] [ERROR] [1726758555.588789834] [controller_manager]: Switch controller timed out after 5.000000 seconds!

[spawner-47] [ERROR] [1726758555.589389964] [spawner_diffdrive_controller]: Failed to activate controller

@ErikParkerrr
Copy link

Also having the same issue. Maybe all the controller stuff needs to be delayed in its spawning till gazebo is up and running? I think it's spawning too early and is timing out before it gets the feedback it needs from gazebo.

@fdila
Copy link
Contributor

fdila commented Sep 21, 2024

I'm having the same issue, did anyone find a solution?

@fdila
Copy link
Contributor

fdila commented Sep 21, 2024

Also having the same issue. Maybe all the controller stuff needs to be delayed in its spawning till gazebo is up and running? I think it's spawning too early and is timing out before it gets the feedback it needs from gazebo.

After some trial and error I found a way to make it work, by launching the ignition simulation and the turtlebot spawn separately:

ros2 launch turtlebot4_ignition_bringup ignition.launch.py

Wait for the simulator to start.

START THE SIMULATION with the small play button on the left. If the simulation is not running the controllers fail to load for some reason.

Then, after the simulation is up and running:

ros2 launch turtlebot4_ignition_bringup turtlebot4_spawn.launch.py

If someone with more experience could chime in and maybe explain what is happening would be nice.
I'd like to keep everything in a single launch file and remove any chance of human error.

@JohannesH1998
Copy link

JohannesH1998 commented Sep 23, 2024

I can confirm that following the method descibed by @fdila results in expected behaviour.
But i also agree that this workaround should not be the only way to get everything to work.
If someone finds a permanent fix, please let me know.

Edit.
It will still work if the original command ros2 launch turtlebot4_ignition_bringup turtlebot4_ignition.launch.py is used, if you quickly press the play icon to start the simulation. Is there a way to automatically start the simulation from the start? This could be a potential fix.

@fdila
Copy link
Contributor

fdila commented Sep 23, 2024

@JohannesH1998 If you modify the ignition.launch.py launch, if you add the -r flag to the ign_arg Ignition starts when it is launched and it seems that now everything is working.

Like this

    # Ignition gazebo
    ignition_gazebo = IncludeLaunchDescription(
        PythonLaunchDescriptionSource([ign_gazebo_launch]),
        launch_arguments=[
            ('ign_args', [LaunchConfiguration('world'),
                          '.sdf',
                          ' -r,
                          ' -v 4',
                          ' --gui-config ',
                          PathJoinSubstitution(
                            [pkg_turtlebot4_ignition_bringup,
                             'gui',
                             LaunchConfiguration('model'),
                             'gui.config'])])
        ]
    )

Then you can use the turtlebot4_ignition.launch.py.
I think I will open a pull request tomorrow in the morning.

@kscottz
Copy link
Contributor

kscottz commented Oct 8, 2024

This works for me. I am going to merge it.

@kscottz kscottz self-assigned this Oct 8, 2024
@pgarcia-dev
Copy link

Same problem here, installing from binaries

@civerachb-cpr
Copy link

I've applied this change to the Jazzy branch too. It looks like this may be related to (yet another) change from ros_control? I haven't looked into what they've changed recently, but if this only recently broke that would be my first hypothesis as to a root cause.

@paoloelle
Copy link

paoloelle commented Nov 8, 2024

So basically the simulation will not work without the -r flag?

@civerachb-cpr
Copy link

@paoloelle that's effectively the situation right now; there was a recent change to ros_controls that added a hard-coded 5s timeout to the startup. If the simulation starts paused, and is not started within 5s, the controllers may timeout, resulting in problems.

We're not sure why ros_control made this change, but we're looking into it and will hopefully submit a merge request to at the very least parameterize it so it can be extended (if this hasn't been done already).

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

No branches or pull requests

10 participants