紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
请问gazebo无法显示静止的长方体模型如何解决:CCS for 3D textures is disabled, but a workaround is available?
-
输出的日志信息如下:
[INFO] [launch]: All log files can be found below /home/fins/.ros/log/2023-03-23-19-25-48-762078-fins-UTG-11522 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [robot_state_publisher-1]: process started with pid [11523] [INFO] [gzserver-2]: process started with pid [11525] [INFO] [gzclient-3]: process started with pid [11527] [INFO] [spawn_entity.py-4]: process started with pid [11529] [robot_state_publisher-1] [INFO] [1679570749.093074638] [robot_state_publisher]: got segment base_link [robot_state_publisher-1] [INFO] [1679570749.093129855] [robot_state_publisher]: got segment dummy [robot_state_publisher-1] [INFO] [1679570749.093135121] [robot_state_publisher]: got segment front_link [spawn_entity.py-4] [INFO] [1679570749.351752070] [spawn_entity]: Spawn Entity started [spawn_entity.py-4] [INFO] [1679570749.351941495] [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] [1679570749.352830954] [spawn_entity]: Waiting for entity xml on robot_description [spawn_entity.py-4] [INFO] [1679570749.478006085] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30 [spawn_entity.py-4] [INFO] [1679570749.478191540] [spawn_entity]: Waiting for service /spawn_entity [spawn_entity.py-4] [INFO] [1679570750.231305805] [spawn_entity]: Calling service /spawn_entity [spawn_entity.py-4] [INFO] [1679570750.400439868] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [rectangle] [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 11529] [gzclient-3] ../src/intel/isl/isl.c:2216: FINISHME: ../src/intel/isl/isl.c:isl_surf_supports_ccs: CCS for 3D textures is disabled, but a workaround is available. code_text
下面是具体的launch文件与urdf模型
1、这是长方体的urdf文件:
<?xml version="1.0" encoding="utf-8"?> <!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com) Commit Version: 1.6.0-4-g7f85cfe Build Version: 1.6.7995.38578 For more information, please see http://wiki.ros.org/sw_urdf_exporter --> <robot name="demo1-3"> <link name="dummy"> </link> <link name="base_link"> <inertial> <origin xyz="0.059269 -0.004969 0.17749" rpy="0 0 0" /> <mass value="1.746" /> <inertia ixx="0.0029237" ixy="3.8969E-05" ixz="-6.1279E-19" iyy="0.0063175" iyz="9.5233E-20" izz="0.0062493" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://gazebo_simulation/meshes/base_link.STL" /> </geometry> <material name=""> <color rgba="1 1 1 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://gazebo_simulation/meshes/base_link.STL" /> </geometry> </collision> </link> <joint name="dummy_joint" type="fixed"> <parent link="dummy"/> <child link="base_link"/> </joint> <link name="front_link"> <inertial> <origin xyz="0.0022355 0.01995 -0.00025958" rpy="0 0 0" /> <mass value="0.071103" /> <inertia ixx="1.4695E-05" ixy="-5.6331E-22" ixz="-2.0294E-22" iyy="2.6451E-05" iyz="-5.6257E-22" izz="3.0622E-05" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://gazebo_simualtion/meshes/front_link.STL" /> </geometry> <material name=""> <color rgba="0.79216 0.81961 0.93333 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://gazebo_simulation/meshes/front_link.STL" /> </geometry> </collision> </link> <joint name="line_joint" type="fixed"> <origin xyz="0.077552 -0.17785 0.016113" rpy="1.5708 0 0" /> <parent link="base_link" /> <child link="front_link" /> <axis xyz="0 0 0" /> </joint> </robot> ''' 2、然后launch文件如下: (1)view_gazebo_tribot.launch.py
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 PythonLaunchDescriptionSourcefrom 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='gazebo_simulation' #<--- CHANGE ME world_file_path = 'worlds/neighborhood.world' pkg_path = os.path.join(get_package_share_directory(package_name)) world_path = os.path.join(pkg_path, world_file_path) # Pose where we want to spawn the robot spawn_x_val = '0.0' spawn_y_val = '0.0' spawn_z_val = '0.0' spawn_yaw_val = '0.0' tribot = IncludeLaunchDescription( PythonLaunchDescriptionSource([os.path.join( get_package_share_directory(package_name),'launch','tribot.launch.py' )]), launch_arguments={'use_sim_time': 'true', 'world':world_path}.items() ) # 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', 'rectangle', '-x', spawn_x_val, '-y', spawn_y_val, '-z', spawn_z_val, '-Y', spawn_yaw_val], output='screen') # Launch them all! return LaunchDescription([ tribot, gazebo, spawn_entity, ])
其中调用的tribot.launch.py文件如下:
import os
from ament_index_python.packages import get_package_share_directory
import launch
from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument
from launch_ros.actions import Nodeimport xacro
def generate_launch_description():
# Check if we're told to use sim time use_sim_time = LaunchConfiguration('use_sim_time') # Process the URDF file pkg_path = os.path.join(get_package_share_directory('gazebo_simulation')) xacro_file = os.path.join(pkg_path,'urdf','demo1-3.urdf') robot_description_config = xacro.process_file(xacro_file) # Create a robot_state_publisher node params = {'robot_description': robot_description_config.toxml(), 'use_sim_time': use_sim_time} node_robot_state_publisher = Node( package='robot_state_publisher', executable='robot_state_publisher', output='screen', parameters=[params] ) # Launch! return LaunchDescription([ DeclareLaunchArgument( 'use_sim_time', default_value='false', description='Use sim time if true'), node_robot_state_publisher ])