Skip to content

Commit df98828

Browse files
authored
Merge pull request #125 from mqcmd196/add-pick-object-xyz-and-palm
[spoteus] impl gripping xyz-axis constraint and grasp_palm_to_fingertip in PickObjectInImage client
2 parents 81fdd63 + 273351d commit df98828

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

‎jsk_spot_robot/spoteus/spot-interface.l‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,31 @@
215215
(ros::ros-info "manipulator-state-is-gripper-holding-item ~A" s)
216216
s))
217217
(:pick-object-in-image
218-
(image-source x y &optional (max-duration 15))
218+
(image-source x y
219+
&key (max-duration 15) (wait t) grasp_constraint grasp_palm_to_fingertip axis_on_gripper_ewrt_gripper axis_to_align_with_ewrt_vo)
220+
(send pick-object-in-image-client :wait-for-server)
219221
(let ((goal (instance spot_msgs::PickObjectInImageActionGoal :init)))
220222
(print (list image-source x y max-duration))
221223
(send goal :goal :image_source image-source)
222224
(send goal :goal :center (instance geometry_msgs::Point :init :x x :y y))
225+
(case grasp_constraint
226+
(:FORCE_TOP_DOWN_GRASP (send goal :goal :grasp_constraint 1))
227+
(:FORCE_HORIZONTAL_GRASP (send goal :goal :grasp_constraint 2))
228+
(:FORCE_45_ANGLE_GRASP (send goal :goal :grasp_constraint 3))
229+
(:FORCE_SQUEEZE_GRASP (send goal :goal :grasp_constraint 4))
230+
(t (ros::ros-info "No grasp constraint")))
231+
(if grasp_palm_to_fingertip (send goal :goal :grasp_palm_to_fingertip grasp_palm_to_fingertip))
232+
(cond (axis_on_gripper_ewrt_gripper
233+
(send goal :goal :axis_on_gripper_ewrt_gripper :x (elt axis_on_gripper_ewrt_gripper 0))
234+
(send goal :goal :axis_on_gripper_ewrt_gripper :y (elt axis_on_gripper_ewrt_gripper 1))
235+
(send goal :goal :axis_on_gripper_ewrt_gripper :z (elt axis_on_gripper_ewrt_gripper 2))))
236+
(cond (axis_to_align_with_ewrt_vo
237+
(send goal :goal :axis_to_align_with_ewrt_vo :x (elt axis_to_align_with_ewrt_vo 0))
238+
(send goal :goal :axis_to_align_with_ewrt_vo :y (elt axis_to_align_with_ewrt_vo 1))
239+
(send goal :goal :axis_to_align_with_ewrt_vo :z (elt axis_to_align_with_ewrt_vo 2))))
223240
(send goal :goal :max_duration (instance ros::duration :init max-duration))
224241
(send pick-object-in-image-client :send-goal goal :feedback-cb `(lambda (msg) (send ,self :pick-object-in-image-feedback-cb msg)))
242+
(if wait (send (send self :pick-object-in-image-wait-for-result) :success))
225243
))
226244
(:pick-object-in-image-feedback-cb
227245
(msg)

0 commit comments

Comments
 (0)