0
$\begingroup$

Rosanswers logo

(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 libgraspit_dbase_tasks.so and libdbase_grasp_planner.so 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 write SQL for it? I don't think I can do the SQL correctly. Anyone have any ideas how to fix this error?

(Or enlighten me on perhaps I don't have to be going down this path at all?? It just seems I'm so close to getting it.)

Thank you so much!

UPDATE:

Okay I created a SQL function get_mark_next_dbase_task_of_type (IN text[], OUT integer) in the database. GraspIt can find that function now, but I get another error

Processing arguments 
 Function name dbase_grasp_planning
plugin creator autostart 1
[ INFO] [1368436156.950132731]: Function call: get_mark_next_dbase_task_of_type(ARRAY['GRASP_PLANNING','GRASP_CLUSTERING'])
[ERROR] [1368436156.955453342]: Database load field: no entry found for key value 95320 on column dbase_task_id
Failed to load planning task for task id 95320
Failed to get planning record for task
[ INFO] [1368436157.077306152]: Function call: get_mark_next_dbase_task_of_type(ARRAY['GRASP_PLANNING','GRASP_CLUSTERING'])
[ERROR] [1368436157.079946708]: Database load field: no entry found for key value 95320 on column dbase_task_id
Failed to load planning task for task id 95320
Failed to get planning record for task

But there IS an entry with dbase_task_id [primary key] 95320, dbase_task_type GRASP_CLUSTERING, dbase_task_outcome_name COMPLETED. This is the original entry, I haven't added any TO_RUN yet.

Not sure whether my SQL script is returning the right thing. I return dbase_task_id right now. Any ideas?


Originally posted by mz on ROS Answers with karma: 11 on 2013-05-12

Post score: 1


Original comments

Comment by Matei Ciocarlie on 2013-05-14:
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.

Comment by mz on 2013-05-14:
(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?

Comment by mz on 2013-05-17:
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.

Comment by Aaron Blasdel on 2014-08-11:
Does anyone know if the mentioned "generating grasps tutorial" ever got created?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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
$BODY$
DECLARE next_id INTEGER;
 BEGIN
 SELECT dbase_task_id INTO next_id FROM dbase_task
        WHERE dbase_task_type = ANY ($1)
    LIMIT 1 FOR UPDATE;
 UPDATE dbase_task SET dbase_task_outcome_name = 'RUNNING'
    WHERE dbase_task_id = next_id;
 return next_id;
 END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  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 ( www.cs.columbia.edu/~cmatei/graspit/html-manual/graspit-manual_12.html#id5 ). 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].


Originally posted by mz with karma: 11 on 2013-05-28

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

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