Open ArjunSikhwal opened 5 years ago
@ArjunSikhwal how you using this package with pick and place?
Maybe a bit old, but here's how I did it (note that I did not need object orientation):
import rospy
import tf
def get_pose_coord():
listener = tf.TransformListener()
listener.waitForTransform("/camera_rgb_optical_frame", "object_id", rospy.Time(), rospy.Duration(4.0))
(trans, rot) = listener.lookupTransform('camera_rgb_optical_frame', 'object_id', rospy.Time())
goal_coord = [trans[0], trans[1], trans[2]] # x, y, z
return goal_coord
Feel free to replace object_id with whatever object prefix you are using. Please also note that you need to do a static transform publication to get camera frame in correct position and orientation in reference to the robot base frame.
Hey, were you able to get the image co-ordinates using the find_object package?
Using the homography and size of the object, you can derive the corners like in this example: https://github.com/introlab/find-object/blob/fd9270a5617f31087bc61c3fae919961a2240b78/src/ros/print_objects_detected_node.cpp#L60-L75
Hi @matlabbe, but these corner values aren't in pixels, right? How to get the values in pixels? I want to use it for image based visual serving. Thanks
Yeah, they should be in pixels. When launching the node print_objects_detected
, here is an example of output of the code above, the corners are in pixels:
$ rosrun find_object_2d print_objects_detected
---
No objects detected.
---
Object 1 detected, Qt corners at (245.456680,97.388290) (396.141483,97.715099) (239.838840,384.329650) (394.736687,362.925157)
---
Object 1 detected, Qt corners at (239.857468,97.219025) (391.417286,97.380249) (229.270036,385.406300) (389.819694,367.935798)
thanks @matlabbe but aren't pixel values integer?
When doing the homography, we play in subpixel accuracy, thus float. You can round the values if you need intergers.
Okay, thank you very much for helping me out.
Hello , I'm building a pick and place robotic arm and I'm using kinect for object detection can anyone tell me how to get the coordinates of the detected object ? I'm very new to ROS and can't figure it out, really appreciate your help. Thanks in advance