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

GraspIt plugin dbase_grasp_planner computing grasp in database throws error about get_mark_next_dbase_task_of_type

asked 2013-05-12 18:45:00 -0500

mz gravatar image

updated 2013-05-12 23:28:46 -0500

(My goal: I am trying to add new objects to a local copy of the household_objects_database, and compute grasps for them, so that I can test grasps using tabletop_detection and pr2_pick_and_place for some of our own object models. I have done the former - adding object models, but the latter - computing grasps - is giving me problems.)

What I have done so far: I installed a local copy of household_objects_database in a PostgreSQL localhost database, and I added some of our own object models successfully to the database, using insert_model.cpp from household_objects_database, changing the database connection line from wgs36 to localhost.

What I need: Now I would like to compute the grasps for the new objects I added - because seems like the grasps are not automatically computed when the object models are added to the database (Is that correct? Because in the pgadmin3 GUI, I see our new models in original_model and scaled_model tables, but I don't see any grasps for these new scaled_model_ids in the "grasp" table.)

Where I'm stuck:

To compute grasps using the GraspIt plugin in dbase_grasp_planner, I am running this file with some modifications

$ roslaunch graspit_ros_planning ros_graspit_interface.launch

which I got to run following two other ROS Answers pages. (I also changed the IP to localhost in dbTaskDispatcher.cpp, and recompiled my copies of graspit_dbase_tasks and dbase_grasp_planner to generate new and files, the latter is needed by the launch file.)

What all that does is that now the launch file starts the GraspIt plugin, connects to the localhost database successfully. However, GraspIt now throws this error:

Processing arguments 
 Function name dbase_grasp_planning
plugin creator autostart 1
[ INFO] [1368320844.809613707]: Function call: get_mark_next_dbase_task_of_type(ARRAY['GRASP_PLANNING','GUIDED_GRASP_PLANNING','VELO_GRASP_PLANNING','GRASP_CLUSTERING'])
[ERROR] [1368320844.922216835]: Database get list: query failed. Error: ERROR:  function get_mark_next_dbase_task_of_type(text[]) does not exist
LINE 1: SELECT get_mark_next_dbase_task_of_type  FROM get_mark_next_...
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

[ERROR] [1368320844.922357154]: Failed to get the id of the next task of given type to be run
[ERROR] [1368320844.922438910]: Function call: get_mark_next_dbase_task_of_type(ARRAY['GRASP_PLANNING','GUIDED_GRASP_PLANNING','VELO_GRASP_PLANNING','GRASP_CLUSTERING'])
Dispatcher: error reading next task
deleting IVmgr
QThreadStorage: Thread 0xaac540 exited after QThreadStorage 7 destroyed

I searched for get_mark_next_dbase_task_of_type many times, and all that comes up is the source code from household_objects_database/database_task.h. Seems like it's looking for a function called get_mark_next_dbase_task_of_type in the database, but the database only has 4 Functions, compute_grasp_robustness, get_grasps, get_models, update_grasps, none of them are that.

I see what it's looking for. Tables dbase_task, dbase_task_type, task_outcome all have relevant stuff. It's trying to get the columns from dbase_task that say TO_RUN, set them to RUNNING, and runs them; when it finishes a task, it sets it to COMPLETED. But I don't know how to give them to it.

So I am reaching a conjecture that I have to create entries in the table that say TO_RUN, create that get_mark_next_dbase_task_of_type() SQL function in the database, and then ... (more)

edit retag flag offensive close merge delete


The "get_mark..." function does need to be in the database, and it should be in the latest version... Which version of the database did you download? Then, generating grasps is indeed not documented - I will try to add a short tutorial on the wiki.

Matei Ciocarlie gravatar image Matei Ciocarlie  ( 2013-05-14 10:02:45 -0500 )edit

(Thank you SO much for the response, Matei! I was about to email you just now.) Hmm I downloaded the household_objects-0.6_fuerte_prerelease_1.backup, is that not the latest version? Is the SQL function accessible somewhere in a repo that I can just copy-paste it into my function?

mz gravatar image mz  ( 2013-05-14 10:18:48 -0500 )edit

We found that in a previous version of the .backup file, the 0.5_electric one, there were functions get_mark_next_dbase_task(), get_mark_next_task(), and save_grasp(), which are not in the 0.6_fuerte.backup file. Still, there is no get_mark_next_dbase_task_of_type() though.

mz gravatar image mz  ( 2013-05-17 11:23:28 -0500 )edit

Does anyone know if the mentioned "generating grasps tutorial" ever got created?

Aaron Blasdel gravatar image Aaron Blasdel  ( 2014-08-11 16:25:02 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-28 10:08:43 -0500

mz gravatar image

updated 2013-05-28 10:09:31 -0500

Solution: I wrote my own get_mark_next_dbase_task_of_type(), which worked and added grasps to the database successfully for GRASP_PLANNING and GRASP_CLUSTERING tasks. I did not test it with the other two types (GUIDED_GRASP_PLANNING, VELO_GRASP_PLANNING). It is written based on the get_mark_next_dbase_task() from the 0.5_electric.backup file.

-- Function: get_mark_next_dbase_task_of_type(text[])

-- DROP FUNCTION get_mark_next_dbase_task_of_type(text[]);

CREATE OR REPLACE FUNCTION get_mark_next_dbase_task_of_type(IN dbasetasktype text[])
  RETURNS integer AS
 SELECT dbase_task_id INTO next_id FROM dbase_task
        WHERE dbase_task_type = ANY ($1)
 UPDATE dbase_task SET dbase_task_outcome_name = 'RUNNING'
        WHERE dbase_task_id = next_id;
 return next_id;
  COST 100;
ALTER FUNCTION get_mark_next_dbase_task_of_type(text[])
  OWNER TO willow;

Change willow in the last line to whatever your username is.

Another thing I had to do before the grasps would calculate correctly was to rescale our model to be much smaller. Rule of thumb is that both the object and the arm you're using should show up in GraspIt. Manually running GraspIt Eigengrasp Planner to see what's supposed to happen helps ( ). The ROS GraspIt plugin uses the Eigengrasp Planner with Search Space Complete and simulated annealing to output the [tx ty tz qw qx qy qz].

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-05-12 18:45:00 -0500

Seen: 427 times

Last updated: May 28 '13