ros-simulation / gazebo_ros_pkgs

Wrappers, tools and additional API's for using ROS with Gazebo
http://wiki.ros.org/gazebo_ros_pkgs
756 stars 770 forks source link

[ROS2] Could not spawn URDF model #1236

Open atinfinity opened 3 years ago

atinfinity commented 3 years ago

Description

I tried to spawn URDF model using gazebo_ros. But, I could not spawn URDF model.

To Reproduce

I used https://github.com/ros/urdf_tutorial/blob/master/urdf/05-visual.urdf.

ros2 launch gazebo_ros gazebo.launch.py
ros2 run gazebo_ros spawn_entity.py -file $HOME/dev_ws/src/urdf_tutorial/urdf/05-visual.urdf -entity 05

The message of this command is as follows.

$ ros2 run gazebo_ros spawn_entity.py -file $HOME/dev_ws/src/urdf_tutorial/urdf/05-visual.urdf -entity 05
[INFO] [1613667021.959447709] [spawn_entity]: Spawn Entity started
[INFO] [1613667021.960142006] [spawn_entity]: Loading entity XML from file /home/dandelion/dev_ws/src/urdf_tutorial/urdf/05-visual.urdf
[INFO] [1613667021.962618085] [spawn_entity]: Waiting for service /spawn_entity, timeout = 5
[INFO] [1613667021.963103341] [spawn_entity]: Waiting for service /spawn_entity
[INFO] [1613667021.967460842] [spawn_entity]: Calling service /spawn_entity
[INFO] [1613667022.131465118] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [05]

Expected behavior

I expected that 05-visual.urdf spawns in Gazebo world.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context

I found related issue.

newcanopies commented 3 years ago

I have this same issue on the same Environment.

~/ws_ROS2/src/urdf_tutorial$ ros2 run gazebo_ros spawn_entity.py -file $HOME/ws_ROS2/src/urdf_tutorial/urdf/05-visual.urdf -entity 05

[INFO] [1620056439.733433900] [spawn_entity]: Spawn Entity started
[INFO] [1620056439.734061900] [spawn_entity]: Loading entity XML from file /home/user/ws_ROS2/src/urdf_tutorial/urdf/05-visual.urdf
[INFO] [1620056439.738093900] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[INFO] [1620056439.739691600] [spawn_entity]: Waiting for service /spawn_entity
[INFO] [1620056439.752784100] [spawn_entity]: Calling service /spawn_entity
[INFO] [1620056439.923853000] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [05]

A model named "05" is loaded in Gazebo model tab, but it is not visible in the world.

atinfinity commented 3 years ago

@newcanopies Thank you for your information. I converted from URDF to SDF to avoid this issue.

atinfinity commented 3 years ago

@newcanopies I don't use moveit2. So, I used model file properly as follows.

aihoque2 commented 1 year ago

check your ~/.gazebo/client-xxxx for a default.log file. it should contain your issue. What helped me was moving my package into ~/.gazebo/models/ directory, and I wonder how we do that in the ros2 launch file.