Ask Your Question
0

How to retrieve object name by providing object id?

asked 2012-10-18 20:32:53 -0500

updated 2012-10-21 04:51:21 -0500

Hi, I have run pr2_pick_and_place_demos and got object_id for a cup.

After retrieving the object id, I want to know the name of the detected object in data base, I found that there's a service handling this kind of request(which is stated here.)

But I cannot find this service with "rosservice list"(obviously it is not launched), I want to ask if anyone knows how to start this service so that I can request the name with this snippet of code.

Edit:

(The code below works if you create a package named getObjectName and depend this package on household_objects_database_msgs)

#!/usr/bin/env python
import roslib; 
roslib.load_manifest('getObjectName') #For loading srv in household_objects_database_msgs 

import rospy
from household_objects_database_msgs.srv import *

rospy.wait_for_service('/objects_database_node/get_model_description')
get_object_name=rospy.ServiceProxy('objects_database_node/get_model_description',GetModelDescription)
resp = get_object_name(18744) #Object id is 18744
print resp

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-10-18 23:08:39 -0500

Lorenz gravatar image

The services for dealing with the PR2 object database are provided by the node household_objects_database. Once set up correctly, it will provide a bunch of services, including:

  • /objects_database_node/get_model_list
  • /objects_database_node/get_model_description
  • /objects_database_node/get_model_mesh

rosservice list | grep objects_database_node should give you a complete list.

Note that you'll have to set up a Postgre SQL server and import the object database.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-10-18 20:32:53 -0500

Seen: 227 times

Last updated: Oct 21 '12