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

Visualizing objects in rviz

asked 2011-11-27 12:23:21 -0500

zamboni gravatar image

Guys, i am completely new to ROS and trying to learn how to get things done. I am trying to model an environment where I have two objects and the pr2 in my world. The launch file is the following:

<launch>

 <!-- Launch PR2 in empty world -->
 <include file="$(find pr2_gazebo)/pr2_empty_world.launch"/>

 <!-- send urdf to param server -->
 <param name="object1" textfile="/home/x/ros_workspace/project/objects/urdf/object1.urdf" />
 <param name="object2" textfile="/home/ros_workspace/project/objects/urdf/object2.urdf" />

 <!-- push urdf to factory and spawn robot in gazebo -->
 <node name="spawn_object1" pkg="gazebo" type="spawn_model" args="-urdf -param object1 -x 3.0 -y 3.0 -z 0.1  -model object1" respawn="false" output="screen" />
 <node name="spawn_object2" pkg="gazebo" type="spawn_model" args="-urdf -param object2 -x 2.75 -y 3.5 -z 0.25  -model object2" respawn="false" output="screen" />

</launch>

My objects get correctly spanwned and I can visualize them in gazebo, but they do not appear on rviz. How would I see the objects in rviz?

Thanks

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
1

answered 2011-11-28 19:22:11 -0500

ZdenekM gravatar image

updated 2011-11-29 19:06:21 -0500

You have to upload URDF model of your object to ROS parameter server (object1, object2) - it's already in your launch file.

Then you have to add its display in RVIZ - type robot model (set robot description to "object1"). For object2 you have to add next robot model display.

And finally publish transformations via TF - sample code for this task is here. It's reading (one) object position from Gazebo and publishing transformation between world frame, robot base_link and object link.

edit flag offensive delete link more
0

answered 2011-11-29 03:08:43 -0500

zamboni gravatar image

the link you provided does not work.

Also, by this "Then you have to add its display in RVIZ - type robot model (set robot description to "object1"). For object2 you have to add next robot model display." you mean the following? <param name="object1" command="cat /home/x/ros_workspace/project/objects/urdf/object1.urdf"/>

Sorry but it is still not clear to me. Thanks

edit flag offensive delete link more

Comments

Ok, link is now working. For reply to answer you should use comment, not new answer ;-) By adding robot model into RVIZ I mean adding appropriate display type into RVIZ, see user guide on ROS wiki (http://www.ros.org/wiki/rviz/UserGuide).
ZdenekM gravatar image ZdenekM  ( 2011-11-29 19:06:50 -0500 )edit
Purpose of mentioned line (param ...) is to upload object description in form or URDF file (which is XML) to ROS parameter server.
ZdenekM gravatar image ZdenekM  ( 2011-11-29 19:13:09 -0500 )edit
0

answered 2011-11-27 13:07:28 -0500

gavinmachine gravatar image

Try adding this to your launch file (add your values where appropriate):

<launch>
    <param name="robot_description" command="cat $(find packagename)/model.xml" />
</launch>

Taken from here.

edit flag offensive delete link more
0

answered 2011-11-28 04:12:45 -0500

zamboni gravatar image

what would it be my model.xml?

I have object1.urdf which is in the format: <robot name="" ...&gt;="" <link="" name="" ...&gt;<="" p="">

but it won't be recognized as an xml file. Any suggestion?

Thanks

edit flag offensive delete link more

Comments

Did you look at the link posted above? Also, here is the xml format required: http://www.ros.org/wiki/urdf/XML/Link. Note: In the future please use the "comment" box for follow up questions, do not post in the "answer" box.
gavinmachine gravatar image gavinmachine  ( 2011-11-28 04:45:35 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2011-11-27 12:23:21 -0500

Seen: 6,563 times

Last updated: Nov 29 '11