Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to spawn a custom urdf in gazebo ignition (ros humble) through a launch file and configure GZ_SIM_RESOURCE_PATH #684

Closed
julioGSabka opened this issue Jan 15, 2025 · 1 comment

Comments

@julioGSabka
Copy link

I'm trying to import a urdf into gazebo ignition, at the moment this is my launch file

=======================
#!/usr/bin/env python3
import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import ExecuteProcess, AppendEnvironmentVariable
from launch.substitutions import Command
from launch_ros.actions import Node

def generate_launch_description():

gz_world = "my_world.sdf"

Set gazebo environment variables

gazebo_sim_pkg = get_package_share_directory('gazebo_simulation')
urdf_pkg = get_package_share_directory('my_bot_description')

models_path = urdf_pkg + "/my_bot"
worlds_path = gazebo_sim_pkg + "/worlds"

os.environ['GZ_SIM_RESOURCE_PATH'] = models_path + ":" + worlds_path

Gazebo Simulator

worlds_fullpath = gazebo_sim_pkg + "/worlds/" + gz_world
gz_proc = ExecuteProcess(cmd=['ign', 'gazebo', worlds_fullpath], output='screen')

return LaunchDescription([
gz_proc

])

==============================
And to spawn the urdf I use the following terminal command:

ign service -s /world/my_world/create --reqtype ignition.msgs.EntityFactory --reptype ignition.msgs.Boolean --timeout 1000 --req 'sdf_filename: "src/my_bot_description/my_bot/robot.urdf", name: "my_bot"'

my urdf is entirely made up of meshes, and when trying to spawn the urdf I encounter the following errors, despite this within igntion it appears as if the robot had been spawned, it just doesn't find the path of the meshes

[ign-1] [Err] [SystemPaths.cc:378] Unable to find file with URI [model://my_bot/lidar1.stl]
[ign-1] [Err] [SystemPaths.cc:473] Could not resolve file [model://my_bot/lidar1.stl]
[ign-1] [Err] [MeshManager.cc:173] Unable to find file[model://my_bot/lidar1.stl]
[ign-1] [Err] [SystemPaths.cc:378] Unable to find file with URI [model://my_bot/lidar2.stl]
[ign-1] [Err] [SystemPaths.cc:473] Could not resolve file [model://my_bot/lidar2.stl]
[ign-1] [Err] [MeshManager.cc:173] Unable to find file[model://my_bot/lidar2.stl]
[ign-1] [Err] [SystemPaths.cc:378] Unable to find file with URI [model://my_bot/camera_1.stl]
[ign-1] [Err] [SystemPaths.cc:473] Could not resolve file [model://my_bot/camera_1.stl]
[ign-1] [Err] [MeshManager.cc:173] Unable to find file[model://my_bot/camera_1.stl]
[ign-1] [Err] [SystemPaths.cc:378] Unable to find file with URI [model://my_bot/camera_2.stl]
[ign-1] [Err] [SystemPaths.cc:473] Could not resolve file [model://my_bot/camera_2.stl]
[ign-1] [Err] [MeshManager.cc:173] Unable to find file[model://my_bot/camera_2.stl]
[ign-1] [Err] [SystemPaths.cc:378] Unable to find file with URI [model://my_bot/roda_de_carga.stl]
[ign-1] [Err] [SystemPaths.cc:473] Could not resolve file [model://my_bot/roda_de_carga.stl]
[ign-1] [Err] [MeshManager.cc:173] Unable to find file[model://my_bot/roda_de_carga.stl]

@azeey
Copy link
Contributor

azeey commented Jan 15, 2025

Thanks for the issue, but this is a type of question that is best asked on https://robotics.stackexchange.com/. I encourage you to post your question there and if you find that there's a specific bug or feature request, come back and create a new issue here. In the mean time, I'll go ahead and close this.

@azeey azeey closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2025
@github-project-automation github-project-automation bot moved this from Inbox to Done in Core development Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants