0
$\begingroup$

Gazebo Answers logo

Hi, there. I encountered a problem, I don’t know how to load xacro file into gazebo in ros2

In ROS1, we could load model XML from ros parameter

<param name="robot_description" command="$(find xacro)/xacro --inorder '$(find m_bot_description)/urdf/mbot_gazebo.xacro'"/>
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model mrobot -param robot_description"/> 

And in ROS2, I've found that the ros2 launch have already supported the command, maybe I guess the launch file could be written as

image description

I hope there is an option something like -param in the code where I type -???, but I only found -file, -topic, -stdin in the spawn_entity.py to load the xml

How could I modify it to load the xacro file?

Thanks in advance!


Originally posted by Jony on Gazebo Answers with karma: 3 on 2021-04-12

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

That is a good question:

Looking into the examples, all I can say is that seems like the new approach is using a topic named robot_description to load xacro code. See https://github.com/ros-simulation/gazebo_ros2_control/blob/master/gazebo_ros2_control_demos/launch/cart_example_effort.launch.py#L55. I can not find any other code using parameters.

To complete the information I've updated the gazebo_ros_pkgs migration wiki https://github.com/ros-simulation/gazebo_ros_pkgs/wiki/ROS-2-Migration:-Spawn-and-delete

Hope it helps.


Originally posted by Jose Luis Rivero with karma: 1485 on 2021-04-19

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Jony on 2021-04-19:
Thanks very much

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.