Open Drojas251 opened 3 years ago
I know its late but still, try this. In mesh filename details, change 'package://' to absolute path on your system for every links. Hope this works
hi Thanks a lot KACHAPPILLY2021. my case was filename="package://my_robot_description/meshes/.....STL" I changed it to filename="$(find my_robot_description)/meshes/.....STL" and meshes were appeared in Gazebo
@munjer1990 @KACHAPPILLY2021
I still have the same issue, I tried to put absolute path, tried $(find package), but nothing working. Ubuntu Humble 22.04 [spawn_entity.py-4] [INFO] [1699594524.611441036] [spawn_entity]: Waiting for entity xml on arduino_urdf the package is called arduino_urdf, which inside has meshes folder and urdf folder and launch folder.
this is from arduinobot.urdf.xacro
this is full gazebo.launch.py
import os from ament_index_python.packages import get_package_share_directory, get_package_prefix
from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, SetEnvironmentVariable from launch.substitutions import Command, LaunchConfiguration from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node from launch_ros.parameter_descriptions import ParameterValue
def generate_launch_description(): arduinobot_description_dir = get_package_share_directory('arduino_urdf') arduinobot_description_share = os.path.join(get_package_prefix('arduino_urdf'), 'share') gazebo_ros_dir = get_package_share_directory('gazebo_ros')
model_arg = DeclareLaunchArgument(name='model', default_value=os.path.join(
arduinobot_description_dir, 'urdf', 'arduinobot.urdf.xacro'
),
description='Absolute path to robot urdf file'
)
env_var = SetEnvironmentVariable('GAZEBO_MODEL_PATH', arduinobot_description_share)
robot_description = ParameterValue(Command(['xacro ', LaunchConfiguration('model')]),
value_type=str)
robot_state_publisher_node = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
parameters=[{'robot_description': robot_description}]
)
start_gazebo_server = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(gazebo_ros_dir, 'launch', 'gzserver.launch.py')
)
)
start_gazebo_client = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(gazebo_ros_dir, 'launch', 'gzclient.launch.py')
)
)
spawn_robot = Node(package='gazebo_ros', executable='spawn_entity.py',
arguments=['-topic', 'arduino_urdf',
'-entity', 'arduinobot'
],
output='screen'
)
return LaunchDescription([
env_var,
model_arg,
start_gazebo_server,
start_gazebo_client,
robot_state_publisher_node,
spawn_robot
])
Is there a fix yet? I suffer from the exact same problem!
In the gazebo launch file, try adding positional arguments like this:
spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', arguments=['-topic', 'robot_description', '-entity', 'cartpole', "-x", "0.0", "-y", "0.0", "-z", "0.0" ], output='screen')
Description I am trying to spawn a robot model, described in a urdf, into gazebo 11 from a ros2 python launch file by using the spawn_entity.py node. I am publishing the xml data onto a topic with robot_state_publisher and reading that data from the topic with the spawn_entity node. I am able to spawn the robot successfully if the urdf is made up of built in geomotires ( box, cylinder..), however when I use a mesh to build my robot, spawn_entity node does now spawn those links with a mesh file in gazebo. I have tried multiple files types ( dae, stl, obj) and tried different urdf's.
To Reproduce I have used the launch file from gazebo_ros2_control_demos exactly. The only changes I made was just adding an additional link and joint to the urdf file that was used in that demo, and used a mesh for that link. I have provided a screen shot below. `
`
Expected behavior
I have made sure my files are in the shared folder and that everything is linked properly. If I can spawn a urdf with basic shapes, then I know that my launch file and the node is working as it should. However, I suspect that the mesh information is not completely being transferred from the robot_state_publisher topic to the spawn_entity node.
Screenshots
Here is the portion of the URDF that includes the mesh. I have simply added this link and joint to the test_cart_position.xacro.urdf file in gazebo_ros2_control_demo. The result in gazebo does not display the mesh model. As I said before, I tried multiple file types.
Environment (please complete the following information):
glxinfo | grep 'server glx vendor'
NVIDIA CorporationAdditional context
I have tried the -database argument in the spawn_entity node and passed a gazebo model form the model data base, which is in sdf format and contains meshes, and that worked fine. However, publishing a urdf that contains meshes with robot stat publisher does not work for me.