gpd_ros icon indicating copy to clipboard operation
gpd_ros copied to clipboard

Get_grasps.py with gpd_ros

Open 2000222 opened this issue 2 years ago • 4 comments

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 avatar Jun 08 '22 03:06 2000222