Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exporting more grasp information #68

Closed
qqwan opened this issue Oct 3, 2016 · 5 comments
Closed

exporting more grasp information #68

qqwan opened this issue Oct 3, 2016 · 5 comments

Comments

@qqwan
Copy link

qqwan commented Oct 3, 2016

Hi,

I'd like to pull out the following items for each grasp, and preferably save them into a txt file (like the way hand position and grasp quality is saved when running a planner), and I was just wondering if you can point me to the right functions to use for each parameter.

  • the joint positions of the fingers
  • the contact location and wrench in hand frame for each contact

thanks!

@jvarley
Copy link
Member

jvarley commented Oct 4, 2016

I would possibly recommend the dof values instead of the joint values. you can get them with:

If you just want to hack the EGPlanner in GraspIt!, then you can just add the following lines to get the dof values:
double dof[mHand->getNumDOF()];
mHand->getDOFVals(dof);

And extend the graspRecord class to write whatever information you would like:
https://github.com/graspit-simulator/graspit/blob/master/src/graspRecord.cpp

If you run it with the EGPlannerDlg, then just iterate over the list of grasps in:
https://github.com/graspit-simulator/graspit/blob/master/ui/EGPlanner/egPlannerDlg.cpp#L568

and export them to a file.

If you are doing this with ROS, then take a look at:
https://github.com/CURG/graspit_interface/blob/master/src/graspit_interface.cpp#L783
I exposed some common graspIt! functionality via ros services and an action server for the planner.
There is a python client:
https://github.com/CURG/graspit_commander

@jvarley
Copy link
Member

jvarley commented Oct 4, 2016

In order to get contact locations:
There is alot done with the contacts in the various energy functions for the EGPlanner so it maybe worth poking around in there to see what sorts of things are being done.

For example:
https://github.com/graspit-simulator/graspit/blob/master/src/EGPlanner/energy/contactEnergy.cpp#L21

Shows how to collect the contacts, and if you want to get the contacts in the frame of the body:
https://github.com/graspit-simulator/graspit/blob/master/include/contact/contact.h#L240

You can get the body pose and link of the hand in the world frame using:
https://github.com/graspit-simulator/graspit/blob/master/include/contact/contact.h#L231

So you can get the pose of the contact in the world frame using:
loc * body1->getTran();
Where loc is the location of the contact in the body1 frame of reference. Then from the hand you can call getBase.getTran() to get the pose of the base of the hand in the world frame.

@qqwan
Copy link
Author

qqwan commented Oct 4, 2016

This is very helpful, thanks!

Also, do you have any example files for manually indicating the sampling locations/patterns for the planner?

@jvarley
Copy link
Member

jvarley commented Oct 4, 2016

The EGPlanner uses simulated annealing to sample the planning space. Take a look at the list planner if you want to create a list of grasps and then have graspit report the quality for them. I have been playing around a bit with the list planner Matei originally wrote which sounds like what you are looking for here:
https://github.com/jvarley/graspit/tree/list_planner

Run graspit/
File-> Open -> plannerMug.xml
Grasp-> ListPlanner

I never quite finished this PR, but it should give you many of the components you are after.

@jvarley
Copy link
Member

jvarley commented Oct 4, 2016

Perhaps if you end up going the listPlanner route, you could clean this up a bit and finish the PR?:
#69

@jvarley jvarley closed this as completed Feb 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants