ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Spawn a SDF model in RViz

asked 2022-05-11 23:26:37 -0500

LuisEFA1998 gravatar image

I created a MoveIt package for my robot, which is responsible for the robot appearing in RViz automatically but I don't know how it does it. How can I make a custom SDF model spawn in a certain position inside RViz? I want to add a table and a cube to try to do a pick and place operation, I want to think that it is something similar to how it is done in Gazebo.

What file should I modify to do the above and what lines of code should I add?

edit retag flag offensive close merge delete

Comments

1

I want to think that it is something similar to how it is done in Gazebo.

RViz is not a simulator. Gazebo is.

You cannot "spawn a [..] model in RViz".

The only thing RViz does is visualise data (it's in the name: Robot VIZualiser).

gvdhoorn gravatar image gvdhoorn  ( 2022-05-12 02:24:16 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-05-12 03:35:16 -0500

aarsh_t gravatar image

updated 2022-05-12 03:35:58 -0500

As @gvdhoorn mentioned, RViz is just visualization tool and not a simulation. So to visulize something in RViz it need to be somewhere in gazebo as urdf/xacro format and loaded on ros parameter server as xml.

What you can try if the world is static, (NOTE: It might not work with the block on table that you have to pick)

You can always add new models with urdf file to visualize in the rviz or use it somewhere else. To do that create new urdf file with the required models in the world. What you can do is to use another parameter name instead of the robot_description

<arg default="$(find my_world_description)/urdf/table.urdf.xacro" name="table"/>
<param command="$(find xacro)/xacro $(arg table)" name="world_description"/>

now you can also add this model in rviz as RobotModel and use parameter world_description.

refer this question for more info.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-05-11 23:26:37 -0500

Seen: 1,196 times

Last updated: May 12 '22