atenpas / gpd_ros

ROS wrapper around GPD
BSD 2-Clause "Simplified" License
57 stars 70 forks source link

Get_grasps.py with gpd_ros #26

Open 2000222 opened 2 years ago

2000222 commented 2 years ago

Hello, on Ubuntu 18.04 ROS melodic I've successfully build "gpd_ros" and finish the GPD perception part. Then I'd like to get the cluttered grasps to execute motion planning for my robot with python. So followed by the tutorial in the "forward_version" gpd, I run the following get_grasps.py script:

import rospy
from gpd_ros.msg import GraspConfigList
grasps = []

def callback(msg):
    global grasps
    grasps = msg.grasps

# Create a ROS node.
rospy.init_node('get_grasps')

# Subscribe to the ROS topic that contains the grasps.
sub = rospy.Subscriber('/detect_grasps/plot_grasps', GraspConfigList, callback)

# Wait for grasps to arrive.
rate = rospy.Rate(1)

while not rospy.is_shutdown():    
    print '.'
    if len(grasps) > 0:
        rospy.loginfo('Received %d grasps.', len(grasps))
        break
    rate.sleep()

However, I could not get any cluttered grasps. So could u pls help me :cry: and update new tutorials based on "gpd_ros" ? Thank u very much~

2000222 commented 2 years ago

Also after run "roslaunch gpd_ros ur5.launch" and "python get_grasps.py", we even find the following error in the terminal of "roslaunch gpd_ros ur5.launch" which has visualized the plotted grasps.

Found 19 clusters.
======== Selected grasps ========
Grasp 0: 654.025
Grasp 1: 342.477
Grasp 2: 256.556
Grasp 3: 250.038
Grasp 4: 240.67
Grasp 5: 65.842
Grasp 6: 11.6773
Grasp 7: -31.8433
Grasp 8: -46.0592
Grasp 9: -204.369
Grasp 10: -247.152
Grasp 11: -465.28
Grasp 12: -484.593
Grasp 13: -639.863
Grasp 14: -685.56
Grasp 15: -704.879
Grasp 16: -705.161
Grasp 17: -767.18
Grasp 18: -906.707
Selected the 19 best grasps.
======== RUNTIMES ========
 1. Candidate generation: 23.7171s
 2. Descriptor extraction: 22.8874s
 3. Classification: 38.4952s
==========
 TOTAL: 85.1642s
[ERROR] [1654656901.111600444]: Client [/get_grasps] wants topic /detect_grasps/plot_grasps to have datatype/md5sum [gpd_ros/GraspConfigList/b023d624ebdc1464392309d191c14641], but our version has [visualization_msgs/MarkerArray/d155b9ce5188fbaf89745847fd5882d7]. Dropping connection.

Hope to solve this problem :sob:

atenpas commented 2 years ago

Apologies for the late reply.

The plot_grasps topic contains visualization marker messages which can be used to display the grasps in RViz. The grasps are found on the topic /detect_grasps/clustered_grasps (as a GraspConfigList.)

gtatiya commented 1 year ago

I am also facing this issue. rostopic echo detect_grasps/clustered_grasps does not output anything. I can see the grasp poses when I launch this: roslaunch gpd_ros ur5.launch, how can I access those poses using python code? Please help

gtatiya commented 1 year ago

I was able to fix this issue by doing following: