From bd9e24d90f708562bf096a88986832294eb4df41 Mon Sep 17 00:00:00 2001 From: mizonon Date: Thu, 5 Dec 2024 15:44:58 +0900 Subject: [PATCH] =?UTF-8?q?Gazebo=E3=81=AECamera=E3=83=A2=E3=83=87?= =?UTF-8?q?=E3=83=AB=E5=AF=BE=E5=BF=9C=E3=81=97=E3=81=9F=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=89=E3=81=AEign->gz=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../urdf/crane_plus.gazebo.xacro | 7 ++- .../urdf/crane_plus.urdf.xacro | 1 - crane_plus_gazebo/gui/gui.config | 48 +++++++++---------- .../launch/crane_plus_with_table.launch.py | 45 +++++++++++------ .../worlds/table_with_aruco_cube.sdf | 18 +++---- .../worlds/table_with_red_cube.sdf | 19 ++++---- 6 files changed, 76 insertions(+), 62 deletions(-) diff --git a/crane_plus_description/urdf/crane_plus.gazebo.xacro b/crane_plus_description/urdf/crane_plus.gazebo.xacro index 78a34a0..30a7611 100644 --- a/crane_plus_description/urdf/crane_plus.gazebo.xacro +++ b/crane_plus_description/urdf/crane_plus.gazebo.xacro @@ -27,7 +27,6 @@ name_link_4 name_link_hand use_camera - use_ignition config_package config_file_path "> @@ -76,9 +75,9 @@ - - ogre2 - + + ogre2 + diff --git a/crane_plus_description/urdf/crane_plus.urdf.xacro b/crane_plus_description/urdf/crane_plus.urdf.xacro index 6741ac2..e0906ea 100644 --- a/crane_plus_description/urdf/crane_plus.urdf.xacro +++ b/crane_plus_description/urdf/crane_plus.urdf.xacro @@ -130,7 +130,6 @@ name_link_4="${NAME_LINK_4}" name_link_hand="${NAME_LINK_HAND}" use_camera="$(arg use_camera)" - use_ignition="$(arg use_ignition)" config_package="$(arg gz_control_config_package)" config_file_path="$(arg gz_control_config_file_path)" /> diff --git a/crane_plus_gazebo/gui/gui.config b/crane_plus_gazebo/gui/gui.config index 2c82af0..5bbd025 100644 --- a/crane_plus_gazebo/gui/gui.config +++ b/crane_plus_gazebo/gui/gui.config @@ -28,7 +28,7 @@ - + 3D View false docked @@ -44,77 +44,77 @@ - + floating 5 5 false - + - + false 5 5 floating false - + - + false 5 5 floating false - + - + false 5 5 floating false - + - + false 5 5 floating false - + - + false 5 5 floating false - + - + false 5 5 floating false - + - + false 5 5 floating false - + @@ -166,7 +166,7 @@ - + false 0 0 @@ -180,7 +180,7 @@ - + false 250 0 @@ -194,7 +194,7 @@ - + false 0 50 @@ -203,7 +203,7 @@ floating false #777777 - + false @@ -220,12 +220,12 @@ floating false #777777 - + - + false 300 50 @@ -234,7 +234,7 @@ floating false #777777 - + diff --git a/crane_plus_gazebo/launch/crane_plus_with_table.launch.py b/crane_plus_gazebo/launch/crane_plus_with_table.launch.py index 024cdbd..5258e37 100644 --- a/crane_plus_gazebo/launch/crane_plus_with_table.launch.py +++ b/crane_plus_gazebo/launch/crane_plus_with_table.launch.py @@ -15,7 +15,8 @@ import os from ament_index_python.packages import get_package_share_directory -from crane_plus_description.robot_description_loader import RobotDescriptionLoader +from crane_plus_description.robot_description_loader \ + import RobotDescriptionLoader from launch import LaunchDescription from launch.actions import DeclareLaunchArgument from launch.actions import ExecuteProcess @@ -38,22 +39,27 @@ def generate_launch_description(): declare_world_name = DeclareLaunchArgument( 'world_name', default_value=os.path.join( - get_package_share_directory('crane_plus_gazebo'), 'worlds', 'table.sdf'), + get_package_share_directory('crane_plus_gazebo'), 'worlds', + 'table.sdf'), description='Set world name.' ) # PATHを追加で通さないとSTLファイルが読み込まれない - env = {'IGN_GAZEBO_SYSTEM_PLUGIN_PATH': os.environ['LD_LIBRARY_PATH'], - 'IGN_GAZEBO_RESOURCE_PATH': os.path.dirname( + env = {'GZ_SIM_SYSTEM_PLUGIN_PATH': os.environ['LD_LIBRARY_PATH'], + 'GZ_SIM_RESOURCE_PATH': os.path.dirname( get_package_share_directory('crane_plus_description')) + ':' + - os.path.join(get_package_share_directory('crane_plus_gazebo'), 'models'), + os.path.join(get_package_share_directory('crane_plus_gazebo'), + 'models'), } gui_config = os.path.join( get_package_share_directory('crane_plus_gazebo'), 'gui', 'gui.config') # -r オプションで起動時にシミュレーションをスタートしないと、コントローラが起動しない - ign_gazebo = ExecuteProcess( - cmd=['ign gazebo -r', LaunchConfiguration('world_name'), '--gui-config', gui_config], + gz_gazebo = ExecuteProcess( + cmd=['gz sim -r', + LaunchConfiguration('world_name'), + '--gui-config', + gui_config], output='screen', additional_env=env, shell=True @@ -73,7 +79,9 @@ def generate_launch_description(): description_loader.use_camera = LaunchConfiguration('use_camera') description_loader.use_gazebo = 'true' description_loader.gz_control_config_package = 'crane_plus_control' - description_loader.gz_control_config_file_path = 'config/crane_plus_controllers.yaml' + description_loader.gz_control_config_file_path = ( + 'config/crane_plus_controllers.yaml' + ) description = description_loader.load() move_group = IncludeLaunchDescription( @@ -98,19 +106,24 @@ def generate_launch_description(): ) spawn_joint_state_controller = ExecuteProcess( - cmd=['ros2 run controller_manager spawner joint_state_broadcaster'], + cmd=['ros2 run controller_manager spawner ' + 'joint_state_broadcaster'], shell=True, output='screen', ) spawn_arm_controller = ExecuteProcess( - cmd=['ros2 run controller_manager spawner crane_plus_arm_controller'], + cmd=['ros2 run controller_manager spawner ' + 'crane_plus_arm_controller'], shell=True, output='screen', ) spawn_gripper_controller = ExecuteProcess( - cmd=['ros2 run controller_manager spawner crane_plus_gripper_controller'], + cmd=[ + 'ros2 run controller_manager spawner ' + 'crane_plus_gripper_controller' + ], shell=True, output='screen', ) @@ -118,9 +131,11 @@ def generate_launch_description(): bridge = Node( package='ros_gz_bridge', executable='parameter_bridge', - arguments=['/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock', - 'image_raw@sensor_msgs/msg/Image[ignition.msgs.Image', - 'camera_info@sensor_msgs/msg/CameraInfo[ignition.msgs.CameraInfo'], + arguments=[ + '/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock', + 'image_raw@sensor_msgs/msg/Image[gz.msgs.Image', + 'camera_info@sensor_msgs/msg/CameraInfo[gz.msgs.CameraInfo' + ], output='screen' ) @@ -128,7 +143,7 @@ def generate_launch_description(): SetParameter(name='use_sim_time', value=True), declare_use_camera, declare_world_name, - ign_gazebo, + gz_gazebo, gazebo_spawn_entity, move_group, move_group_camera, diff --git a/crane_plus_gazebo/worlds/table_with_aruco_cube.sdf b/crane_plus_gazebo/worlds/table_with_aruco_cube.sdf index fbc4ce8..7750d85 100644 --- a/crane_plus_gazebo/worlds/table_with_aruco_cube.sdf +++ b/crane_plus_gazebo/worlds/table_with_aruco_cube.sdf @@ -6,33 +6,33 @@ 1.0 + filename="gz-sim-physics-system" + name="gz::sim::systems::Physics"> + filename="gz-sim-user-commands-system" + name="gz::sim::systems::UserCommands"> + filename="gz-sim-scene-broadcaster-system" + name="gz::sim::systems::SceneBroadcaster"> - https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Sun + https://fuel.gazebosim.org/1.0/OpenRobotics/models/Sun - https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Ground%20Plane + https://fuel.gazebosim.org/1.0/OpenRobotics/models/Ground%20Plane - https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Table + https://fuel.gazebosim.org/1.0/OpenRobotics/models/Table 0.29 0 0 0 0 1.5708 diff --git a/crane_plus_gazebo/worlds/table_with_red_cube.sdf b/crane_plus_gazebo/worlds/table_with_red_cube.sdf index 0804c9f..f073c52 100644 --- a/crane_plus_gazebo/worlds/table_with_red_cube.sdf +++ b/crane_plus_gazebo/worlds/table_with_red_cube.sdf @@ -5,34 +5,35 @@ 0.001 1.0 + + filename="gz-sim-physics-system" + name="gz::sim::systems::Physics"> + filename="gz-sim-user-commands-system" + name="gz::sim::systems::UserCommands"> + filename="gz-sim-scene-broadcaster-system" + name="gz::sim::systems::SceneBroadcaster"> - https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Sun + https://fuel.gazebosim.org/1.0/OpenRobotics/models/Sun - https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Ground%20Plane + https://fuel.gazebosim.or/1.0/OpenRobotics/models/Ground%20Plane - https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Table + https://fuel.gazebosim.or/1.0/OpenRobotics/models/Table 0.29 0 0 0 0 1.5708