 
 
 (defn open-gripper [nh]
-  (apply-gripper-force nh true -100)
+  (apply-gripper-force nh true 100)
   (unattach-bottle nh)
   )
 
 (defn close-gripper 
-  ([nh] (close-gripper nh 45))
-  ([nh force] 
+  ([nh] (close-gripper nh 45 false))
+  ([nh force empty?] 
      (apply-gripper-force nh true (- force))
-     (attach-bottle nh)
+     (when-not empty? (attach-bottle nh))
      ))
 
 

(defn find-bottles [nh z]
  (:pts (call-srv nh "/find_bottles" (map-msg FindBottles$Request {:z z}))))

(defn compute-base-grasp-rect 
  "Given a rectangular table and point in map frame, compute a good base state along x edge.
   Return nil if no pose is thought feasible"

		
;  TODO: add timeout
;; TODO: add preempt
;; TODO: attach bottles
;; TODO: ignore result of arm action.
;  TODO: integrate with find_bottles

;;  TODO: extend scrips.
    ; Smart script for grasping - move base + ask for new point, if needed.
;; TODO: fix rotate-toa-angle

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;     States      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
