’m working on a 2 wheel autonomous robot simulation with ROS2 and Gazebo. when never I launch this file gazebo sever crashing error Therefore im trying to setup ros2_control, but i got quiet some problems with it:
My setup: Ubuntu 22.04 Ros humble Gazebo 11.10.2
ros2 launch autonomous_bot launch_sim.launch.py
[INFO] [launch]: All log files can be found below /home/rushabh/.ros/log/2024-04-10-10-20-53-087448-rushabh-Aspire-A515-57G-24269
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [24270]
[INFO] [gzserver-2]: process started with pid [24272]
[INFO] [gzclient-3]: process started with pid [24274]
[INFO] [spawn_entity.py-4]: process started with pid [24276]
[robot_state_publisher-1] [INFO] [1712724653.565116469] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-1] [INFO] [1712724653.565180780] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1712724653.565187384] [robot_state_publisher]: got segment caster_wheel
[robot_state_publisher-1] [INFO] [1712724653.565191307] [robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1712724653.565194777] [robot_state_publisher]: got segment laser_frame
[robot_state_publisher-1] [INFO] [1712724653.565198448] [robot_state_publisher]: got segment left_wheel
[robot_state_publisher-1] [INFO] [1712724653.565201901] [robot_state_publisher]: got segment right_wheel
[spawn_entity.py-4] [INFO] [1712724653.897650338] [spawn_entity]: Spawn Entity started
[spawn_entity.py-4] [INFO] [1712724653.897867387] [spawn_entity]: Loading entity published on topic robot_description
[spawn_entity.py-4] /opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead.
[spawn_entity.py-4] warnings.warn(
[spawn_entity.py-4] [INFO] [1712724653.899170320] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-4] [INFO] [1712724653.901625135] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-4] [INFO] [1712724653.901805336] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-4] [INFO] [1712724654.406948601] [spawn_entity]: Calling service /spawn_entity
[spawn_entity.py-4] [INFO] [1712724654.503504374] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [my_bot]
[gzserver-2] [WARN] [1712724654.505842505] [rcl]: Found remap rule '~/out:=scan'. This syntax is deprecated. Use '--ros-args --remap ~/out:=scan' instead.
[gzserver-2] [WARN] [1712724654.507346550] [rcl]: Found remap rule '~/out:=scan'. This syntax is deprecated. Use '--ros-args --remap ~/out:=scan' instead.
[gzserver-2] [INFO] [1712724654.620310544] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
[gzserver-2] [INFO] [1712724654.621628001] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /
[gzserver-2] [INFO] [1712724654.621737794] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control
[gzserver-2] [INFO] [1712724654.622666022] [gazebo_ros2_control]: connected to service!! robot_state_publisher
[gzserver-2] [INFO] [1712724654.623100631] [gazebo_ros2_control]: Received urdf from param server, parsing...
[gzserver-2] [INFO] [1712724654.623122673] [gazebo_ros2_control]: Loading parameter files /home/rushabh/ros2_ws/install/autonomous_bot/share/autonomous_bot/config/my_controller.yaml
[gzserver-2] [INFO] [1712724654.630469268] [gazebo_ros2_control]: Loading joint: left_wheel_joint
[gzserver-2] [INFO] [1712724654.630495525] [gazebo_ros2_control]: State:
[gzserver-2] [INFO] [1712724654.630511420] [gazebo_ros2_control]: velocity
[gzserver-2] [INFO] [1712724654.630516726] [gazebo_ros2_control]: position
[gzserver-2] [INFO] [1712724654.630521067] [gazebo_ros2_control]: Command:
[gzserver-2] [INFO] [1712724654.630537652] [gazebo_ros2_control]: velocity
[gzserver-2] [INFO] [1712724654.630544866] [gazebo_ros2_control]: Loading joint: right_wheel_joint
[gzserver-2] [INFO] [1712724654.630549345] [gazebo_ros2_control]: State:
[gzserver-2] [INFO] [1712724654.630553345] [gazebo_ros2_control]: velocity
[gzserver-2] [INFO] [1712724654.630557432] [gazebo_ros2_control]: position
[gzserver-2] [INFO] [1712724654.630561172] [gazebo_ros2_control]: Command:
[gzserver-2] [INFO] [1712724654.630566595] [gazebo_ros2_control]: velocity
[gzserver-2] [INFO] [1712724654.630588565] [resource_manager]: Initialize hardware 'GazeboSystem'
[gzserver-2] [INFO] [1712724654.630656757] [resource_manager]: Successful initialization of hardware 'GazeboSystem'
[gzserver-2] [INFO] [1712724654.630698827] [resource_manager]: 'configure' hardware 'GazeboSystem'
[gzserver-2] [INFO] [1712724654.630703790] [resource_manager]: Successful 'configure' of hardware 'GazeboSystem'
[gzserver-2] [INFO] [1712724654.630707221] [resource_manager]: 'activate' hardware 'GazeboSystem'
[gzserver-2] [INFO] [1712724654.630710405] [resource_manager]: Successful 'activate' of hardware 'GazeboSystem'
[gzserver-2] [INFO] [1712724654.630769214] [gazebo_ros2_control]: Loading controller_manager
[INFO] [spawn_entity.py-4]: process has finished cleanly [pid 24276]
[ERROR] [gzserver-2]: process has died [pid 24272, exit code -11, cmd 'gzserver -slibgazebo_ros_init.so -slibgazebo_ros_factory.so -slibgazebo_ros_force_system.so'].
[ERROR] [gzclient-3]: process has died [pid 24274, exit code 255, cmd 'gzclient'].
robot.xarco
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<ros2_control name="GazeboSystem" type="system">
<hardware>
<plugin>gazebo_ros2_control/GazeboSystem</plugin>
</hardware>
<joint name="left_wheel_joint">
<command_interface name="velocity">
<param name="min">-10</param>
<param name="max">10</param>
</command_interface>
<state_interface name="velocity"/>
<state_interface name="position"/>
</joint>
<joint name="right_wheel_joint">
<command_interface name="velocity">
<param name="min">-10</param>
<param name="max">10</param>
</command_interface>
<state_interface name="velocity"/>
<state_interface name="position"/>
</joint>
</ros2_control>
<gazebo>
<plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so">
<parameters>$(find autonomous_bot)/config/my_controller.yaml</parameters>
</plugin>
</gazebo>
</robot>
[```
spawn_entity.py-4] [INFO] [1712814841.208330714] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-4] [INFO] [1712814841.210351790] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-4] [INFO] [1712814841.210528917] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-4] [ERROR] [1712814871.288989281] [spawn_entity]: Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory?
[spawn_entity.py-4] [ERROR] [1712814871.290530628] [spawn_entity]: Spawn service failed. Exiting.
[ERROR] [spawn_entity.py-4]: process has died [pid 16044, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -topic robot_description -entity my_bot --ros-args'].
[gzserver-2] AL lib: (EE) ALCpulsePlayback_connectStream: Stream did not get ready: Timeout
launch file:
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
def generate_launch_description():
# Include the robot_state_publisher launch file, provided by our own package. Force sim time to be enabled
# !!! MAKE SURE YOU SET THE PACKAGE NAME CORRECTLY !!!
package_name='autonomous_bot' #<--- CHANGE ME
rsp = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory(package_name),'launch','rsp.launch.py'
)])
)
# twist_mux_params = os.path.join(get_package_share_directory(package_name),'config','twist_mux.yaml')
# twist_mux = Node(
# package="twist_mux",
# executable="twist_mux",
# parameters=[twist_mux_params, {'use_sim_time': True}],
# remappings=[('/cmd_vel_out','/diff_cont/cmd_vel_unstamped')]
# )
gazebo_params_file = os.path.join(get_package_share_directory(package_name),'config','gazebo_params.yaml')
# Include the Gazebo launch file, provided by the gazebo_ros package
gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')]),
)
# Run the spawner node from the gazebo_ros package. The entity name doesn't really matter if you only have a single robot.
spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
arguments=['-topic', 'robot_description',
'-entity', 'my_bot'],
output='screen')
# Code for delaying a node (I haven't tested how effective it is)
#
# First add the below lines to imports
# from launch.actions import RegisterEventHandler
# from launch.event_handlers import OnProcessExit
#
# Then add the following below the current diff_drive_spawner
# delayed_diff_drive_spawner = RegisterEventHandler(
# event_handler=OnProcessExit(
# target_action=spawn_entity,
# on_exit=[diff_drive_spawner],
# )
# )
#
# Replace the diff_drive_spawner in the final return with delayed_diff_drive_spawner
# Launch them all!
return LaunchDescription([
rsp,
gazebo,
spawn_entity,
])
’m working on a 2 wheel autonomous robot simulation with ROS2 and Gazebo. when never I launch this file gazebo sever crashing error Therefore im trying to setup ros2_control, but i got quiet some problems with it:
My setup: Ubuntu 22.04 Ros humble Gazebo 11.10.2
my_controller.yaml
Spawn_enitiy error:
[``` spawn_entity.py-4] [INFO] [1712814841.208330714] [spawn_entity]: Waiting for entity xml on robot_description [spawn_entity.py-4] [INFO] [1712814841.210351790] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30 [spawn_entity.py-4] [INFO] [1712814841.210528917] [spawn_entity]: Waiting for service /spawn_entity [spawn_entity.py-4] [ERROR] [1712814871.288989281] [spawn_entity]: Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory? [spawn_entity.py-4] [ERROR] [1712814871.290530628] [spawn_entity]: Spawn service failed. Exiting. [ERROR] [spawn_entity.py-4]: process has died [pid 16044, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -topic robot_description -entity my_bot --ros-args']. [gzserver-2] AL lib: (EE) ALCpulsePlayback_connectStream: Stream did not get ready: Timeout
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription from launch.actions import IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
def generate_launch_description():