-
Notifications
You must be signed in to change notification settings - Fork 122
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
Loading Controller Crashes Gazebo Server #67
Comments
As an update, I have tried to recreate my launch file to better represent that in the examples, however I am running into issues launching it, as I get the following error: The launch file is as follows: # Copyright 2020 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler
from launch.event_handlers import OnProcessExit
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
import xacro
def generate_launch_description():
gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']),
)
# gazebo_ros2_control_demos_path = os.path.join(
# get_package_share_directory('gazebo_ros2_control_demos'))
#
# xacro_file = os.path.join(gazebo_ros2_control_demos_path,
# 'urdf',
# 'test_cart_position.xacro.urdf')
#
# doc = xacro.parse(open(xacro_file))
# xacro.process_doc(doc)
urdf_file_name = 'urdf/camera_bot.xacro'
urdf = os.path.join(
get_package_share_directory('ros2_sim_pkg'),
urdf_file_name)
params = {'robot_description': urdf}
node_robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
output='screen',
parameters=[params]
)
spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
arguments=['-topic', 'robot_description',
'-entity', 'cartpole'],
output='screen')
load_joint_state_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_start_controller', 'joint_state_controller'],
output='screen'
)
load_joint_trajectory_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_start_controller', 'joint_trajectory_controller'],
output='screen'
)
return LaunchDescription([
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=spawn_entity,
on_exit=[load_joint_state_controller],
)
),
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=load_joint_state_controller,
on_exit=[load_joint_trajectory_controller],
)
),
gazebo,
node_robot_state_publisher,
spawn_entity,
]) and the terminal output: ay@ubuntu:~/Workspaces/udemy_ros2_ws$ ros2 launch ros2_sim_pkg gazebo_ros2_control_test.launch.py
[INFO] [launch]: All log files can be found below /home/ray/.ros/log/2021-03-31-01-20-49-067692-ubuntu-26382
[INFO] [launch]: Default logging verbosity is set to INFO
Task exception was never retrieved
future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:271> exception=ImportError("cannot import name 'GazeboRosPaths' from 'scripts' (/home/ray/Workspaces/udemy_ros2_ws/install/udemy_ros2_pkg/lib/python3.8/site-packages/scripts/__init__.py)")>
Traceback (most recent call last):
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 273, in _process_one_event
await self.__process_event(next_event)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 293, in __process_event
visit_all_entities_and_collect_futures(entity, self.__context))
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
[Previous line repeated 3 more times]
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
sub_entities = entity.visit(context)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py", line 108, in visit
return self.execute(context)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/include_launch_description.py", line 125, in execute
launch_description = self.__launch_description_source.get_launch_description(context)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_source.py", line 84, in get_launch_description
self._get_launch_description(self.__expanded_location)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/python_launch_description_source.py", line 51, in _get_launch_description
return get_launch_description_from_python_launch_file(location)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/python_launch_file_utilities.py", line 62, in get_launch_description_from_python_launch_file
launch_file_module = load_python_launch_file_as_module(python_launch_file_path)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/python_launch_file_utilities.py", line 37, in load_python_launch_file_as_module
loader.exec_module(mod)
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/ros/foxy/share/gazebo_ros/launch/gzserver.launch.py", line 28, in <module>
from scripts import GazeboRosPaths
ImportError: cannot import name 'GazeboRosPaths' from 'scripts' (/home/ray/Workspaces/udemy_ros2_ws/install/udemy_ros2_pkg/lib/python3.8/site-packages/scripts/__init__.py)
|
Hello, it seems a problem in your gzserver launch file. Is the "gzserver" launch file working fine in your system? Just try: If not, try to reinstall gazebo11 and gazebo_ros_pkgs for ROS2. |
Hi I have the same error (at least the initial one) where loading the controller manager crashes gazebo. There are also no error messages for me except the final one that the gzserver has died. Running |
Hi @Thieso, I am not sure, but I think the initial problem was that the URDF has been passed as an argument to robot_state_publisher:
but it should be given as a parameter (what @808brick already did in the second post):
|
@808brick It seems that your ros2 launch file is looking only for your workspace scripts folder, did you source the ros2 distro? |
Hi @Schulze18 I am already passing it as an argument so that does sadly not solve the problem. |
So further information on this, I ran gazebo with Sadly this is also not helpful for me but maybe you can see some problem there. Any hints are appreciated My launch file is
|
I apologize for being inactive on this thread, was a busy week. @Schulze18 my terminals are automatically sourced to ROS Foxy via .bashrc (so the line I am not on the system in question right now, but I will try to do more experimenting this weekend with the comments you have given and report back. Thanks for all the feedback and help. |
hi @Schulze18 is it even possible to launch Gazebo with both plugins as suggested above #67 (comment) |
Hi @Schulze18, hi @808brick Somehow it seems to function out of the box when looking at eg. https://www.youtube.com/watch?v=xBhYHOSxMOk. My controller config: `
joint_trajectory_controller_spj: joint_trajectory_controller_slj: joint_trajectory_controller_ej: joint_trajectory_controller_w1j: joint_trajectory_controller_w2j: joint_trajectory_controller_w3j: And my xacro: `
` |
Okay, it was my bad. The robot I wanted to control had already ros2_control tags. I added xacro conditionals to determine real HW, fake HW or Gazebo. Problem solved. |
Please don't expect many things to be fixed in Foxy. We'd appreciate if you
could give us feedback about what's on rolling ATM as it will be the
baseline for the Humble release, thanks!
…On Wed, 11 May 2022, 10:58 MXS13, ***@***.***> wrote:
Okay, it was my bad. The robot I wanted to control had already
ros2_control tags. I added xacro conditionals to determine real HW, fake HW
or Gazebo. Problem solved.
—
Reply to this email directly, view it on GitHub
<#67 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA24PYPICHK2KKLNPKR3SZ3VJOADFANCNFSM42ELBKMQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I am trying to utilize the gazebo_ros2_control package for controlling the position of a revolute joint from a URDF file. However following along with the package README (which thankfully is better than most ROS2 pkg README's, so thank you for that), it seems something in the
ros2_control
tag is causing gazebo to crash, as the adding the libgazebo_ros2_control.so file with thegazebo
tags alone without theros2_control
tags does not crash gazebo.My URDF file spawned in fine prior to adding the following to the bottom within the
<robot>
tags. I configured it as follows:With my config file having:
Basically I am trying to create a position controller to interact with my joint called
camera_pole_joint
OS: Ubuntu 20.04
ROS Distro: Foxy (apt install)
Output of terminal running gazebo:
Terminal output of spawning in the URDF does not seem to throw any errors:
Here is my launch file in case it is of use:
I currently have the joint state publisher and auto launching gazebo commented out, as I was trying to make sure those were not interfering with the libgazebo_ros2_control.so.
The text was updated successfully, but these errors were encountered: