process has died [pid 61815, exit code -11, cmd 'gzserver ~/../worlds/empty.world -slibgazebo_ros_init.so -slibgazebo_ros_factory.so -slibgazebo_ros_force_system.so
Hey, hope you all are doing well.
I am working on a basic project where I have to spawn a robot inside Gazebo using ROS 2 framework.
Specifications:
- Gazebo - 11.12.0
- ROS - Foxy
Launch file snippet:
start_robot_state_publisher_cmd = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='screen',
parameters=[{'robot_description': Command(['xacro ', urdf_model])}]
)
# Start Gazebo server
start_gazebo_server_cmd = IncludeLaunchDescription(
PythonLaunchDescriptionSource(os.path.join(pkg_gazebo_ros, 'launch', 'gzserver.launch.py')),
condition=IfCondition(use_simulator),
launch_arguments={'world': world}.items())
# Start Gazebo client
start_gazebo_client_cmd = IncludeLaunchDescription(
PythonLaunchDescriptionSource(os.path.join(pkg_gazebo_ros, 'launch', 'gzclient.launch.py')),
condition=IfCondition(PythonExpression([use_simulator, ' and not ', headless])))
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution([desc_pkg_share, urdf_file_path])
]
)
robot_description = {"robot_description": robot_description_content}
# Launch the robot
spawn_entity_cmd = Node(
package='gazebo_ros',
executable='spawn_entity.py',
name="urdf_spawner",
respawn="false",
output="screen",
arguments=['-entity', 'rrr_arm',
'-topic', 'robot_description',
'-x', '0.0',
'-y', '0.0',
'-z', '0.0',
'-R', '0.0',
'-P', '0.0',
'-Y', '0.0'],
)
ROS Control plugin
<!-- ros_control plugin -->
<gazebo>
<plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so">
<robot_param>robot_description</robot_param>
<robot_param_node>robot_state_publisher</robot_param_node>
</plugin>
</gazebo>
I am able to spawn the robot inside the Gazebo but along with that I am getting some error messages like below one:
spawn_entity.py-3] [INFO] [1680969591.963340683] [urdf_spawner]: Spawn Entity started
[spawn_entity.py-3] [INFO] [1680969591.963842828] [urdf_spawner]: Loading entity published on topic robot_description
[spawn_entity.py-3] [INFO] [1680969591.966458203] [urdf_spawner]: Waiting for entity xml on robot_description
[spawn_entity.py-3] [INFO] [1680969591.979584432] [urdf_spawner]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-3] [INFO] [1680969591.980009624] [urdf_spawner]: Waiting for service /spawn_entity
[spawn_entity.py-3] [INFO] [1680969591.984482216] [urdf_spawner]: Calling service /spawn_entity
[spawn_entity.py-3] [INFO] [1680969592.022885759] [urdf_spawner]: Spawn status: Entity [rrr_arm] already exists.
[spawn_entity.py-3] [ERROR] [1680969592.023441760] [urdf_spawner]: Spawn service failed. Exiting.
[ERROR] [spawn_entity.py-3]: process has died [pid 62196, exit code 1, cmd '/home/anubhav1772/ros2_ws/install/gazebo_ros/lib/gazebo_ros/spawn_entity.py -entity rrr_arm -topic robot_description -x 0.0 -y 0.0 -z 0.0 -R 0.0 -P 0.0 -Y 0.0 --ros-args -r __node:=urdf_spawner']
But sometimes I am not able to spawn robot into the gazebo at all and getting below error output. In this case I have to use killall gzserver
terminal command before running the ros2 launch command to get things working. Also when I am using Ctrl+X
to exit the gazebo(after successful spawning robot), then getting below messages:
[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[robot_state_publisher-4] [INFO] [1680969592.818766277] **[rclcpp]: signal_handler(signal_value=2)**
[spawn_entity.py-3] Traceback (most recent call last):
[spawn_entity.py-3] **File "/home/anubhav1772/ros2_ws/install/gazebo_ros/lib/gazebo_ros/spawn_entity.py", line 31, in <module>**
[spawn_entity.py-3] from geometry_msgs.msg import Pose
[spawn_entity.py-3] File "/opt/ros/foxy/lib/python3.8/site-packages/geometry_msgs/msg/__init__.py", line 21, in <module>
[spawn_entity.py-3] from geometry_msgs.msg._transform_stamped import TransformStamped # noqa: F401
[spawn_entity.py-3] KeyboardInterrupt
[INFO] [robot_state_publisher-4]: process has finished cleanly [pid 61821]
[ERROR] [spawn_entity.py-3]: process has died [pid 62254, exit code -2, cmd '/home/anubhav1772/ros2_ws/install/gazebo_ros/lib/gazebo_ros/spawn_entity.py -entity rrr_arm -topic robot_description -x 0.0 -y 0.0 -z 0 ...