-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert #2235 'Grasp using proximity' #2241
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,11 @@ | |
:super baxter-interface | ||
:slots (rarm-pressure-threshold- | ||
larm-pressure-threshold- | ||
proximity-threshold- | ||
right-hand-action- | ||
pressure- | ||
finger-flex- | ||
finger-load- | ||
prismatic-load- | ||
proximities- | ||
proximity-init-values-)) | ||
prismatic-load-)) | ||
|
||
(defmethod jsk_arc2017_baxter::baxter-interface | ||
(:init | ||
|
@@ -75,8 +72,6 @@ | |
(setq finger-flex- (make-hash-table)) | ||
(setq prismatic-load- (make-hash-table)) | ||
(setq prismatic-vel- (make-hash-table)) | ||
(setq proximities- (make-hash-table)) | ||
(setq proximity-init-values- (make-hash-table)) | ||
(dolist (arm (list :rarm :larm)) | ||
(ros::subscribe (format nil "/gripper_front/limb/~a/pressure/state" (arm2str arm)) | ||
std_msgs::Float64 | ||
|
@@ -92,13 +87,7 @@ | |
dynamixel_msgs::JointState | ||
#'send self :set-prismatic-state arm | ||
:groupname groupname) | ||
(ros::subscribe (format nil "/gripper_front/limb/~a/proximity_array" | ||
(arm2str arm)) | ||
force_proximity_ros::ProximityArray | ||
#'send self :set-proximities arm | ||
:groupname groupname) | ||
(sethash arm finger-flex- (make-hash-table)) | ||
(sethash arm proximity-init-values- (make-hash-table)) | ||
(dolist (side (list :right :left)) | ||
(ros::subscribe (format nil "/gripper_front/limb/~a/flex/~a/state" | ||
(arm2str arm) (symbol2str side)) | ||
|
@@ -164,9 +153,6 @@ | |
(:set-finger-flex | ||
(arm side msg) | ||
(sethash side (gethash arm finger-flex-) (send msg :data))) | ||
(:set-proximities | ||
(arm msg) | ||
(sethash arm proximities- (send msg :proximities))) | ||
|
||
;; Hand interface | ||
;; based on naoqi-interface and fetch-interface | ||
|
@@ -198,10 +184,6 @@ | |
res) | ||
nil) | ||
nil)) | ||
(:cancel-move-hand() | ||
(send right-hand-action- :cancel-goal)) | ||
(:hand-interpolatingp () | ||
(eq (send right-hand-action- :get-state) ros::*simple-goal-state-active*)) | ||
(:get-finger-flex (arm side) | ||
(send self :spin-once) | ||
(gethash side (gethash arm finger-flex-))) | ||
|
@@ -214,22 +196,6 @@ | |
(:get-prismatic-vel (arm) | ||
(send self :spin-once) | ||
(gethash arm prismatic-vel-)) | ||
(:get-proximity (arm side &key (raw nil)) | ||
(send self :spin-once) | ||
(let ((rl (gethash :left (gethash arm proximity-init-values-))) | ||
(rr (gethash :right (gethash arm proximity-init-values-))) | ||
;;(rm (gethash :middle (gethash arm proximity-init-values-))) | ||
(proximities (gethash arm proximities-))) | ||
(if (null raw) | ||
(cond | ||
;; for sparkfun proximity sensor | ||
((eq side :left) | ||
(/ (- (send (elt proximities 0) :average) rl) (expt (/ rl 2500.0) 1.5))) | ||
((eq side :right) | ||
(/ (- (send (elt proximities 1) :average) rr) (expt (/ rr 2500.0) 1.5)))) | ||
(cond | ||
((eq side :left) (send (elt proximities 0) :average)) | ||
((eq side :right) (send (elt proximities 1) :average)))))) | ||
(:get-real-finger-av (arm) | ||
(send self :update-robot-state :wait-until-update t) | ||
(float-vector | ||
|
@@ -259,55 +225,9 @@ | |
((eq type :pinch) | ||
(send self :update-robot-state :wait-until-update t) | ||
(let ((finger-av (send self :get-real-finger-av l/r)) | ||
prev-av av avs hand-interpolatingp) | ||
;; rotate arm using proximity sensor | ||
(prev-av (send robot :angle-vector)) avs) | ||
(setf (aref finger-av 1) 180) | ||
(send self :move-hand l/r finger-av 2000 :wait nil) | ||
(dotimes (x 100) | ||
(if (send self :interpolatingp) (return)) | ||
(unix::usleep 1000)) | ||
(while (and | ||
(< (max (send self :get-proximity l/r :right) | ||
(send self :get-proximity l/r :left)) | ||
proximity-threshold-) | ||
(setq hand-interpolatingp (send self :hand-interpolatingp))) | ||
(unix::usleep 1000)) | ||
(when hand-interpolatingp | ||
(send self :cancel-move-hand) | ||
(send self :update-robot-state :wait-until-update t) | ||
(setq prev-av (send robot :angle-vector)) | ||
(if (< (send self :get-proximity l/r :right) (send self :get-proximity l/r :left)) | ||
(progn | ||
(send robot l/r :wrist-r :joint-angle 45 :relative t) | ||
(setq av (send robot :angle-vector)) | ||
(send robot :angle-vector prev-av) | ||
(send self :angle-vector-raw av 2000) | ||
(send self :move-hand l/r finger-av 4000 :wait nil) | ||
(dotimes (x 100) | ||
(if (send self :interpolatingp) (return)) | ||
(unix::usleep 1000)) | ||
(while (and (< (send self :get-proximity l/r :right) | ||
(send self :get-proximity l/r :left)) | ||
(send self :interpolatingp)) | ||
(unix::usleep 1000))) | ||
(progn | ||
(send robot l/r :wrist-r :joint-angle -45 :relative t) | ||
(setq av (send robot :angle-vector)) | ||
(send robot :angle-vector prev-av) | ||
(send self :angle-vector-raw av 2000) | ||
(send self :move-hand l/r finger-av 4000 :wait nil) | ||
(dotimes (x 100) | ||
(if (send self :interpolatingp) (return)) | ||
(unix::usleep 1000)) | ||
(while (and (> (send self :get-proximity l/r :right) | ||
(send self :get-proximity l/r :left)) | ||
(send self :interpolatingp)) | ||
(unix::uleep 1000))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo |
||
(send self :cancel-move-hand) | ||
(send self :cancel-angle-vector) | ||
(send self :update-robot-state :wait-until-update t) | ||
(send self :move-hand l/r finger-av 1000)) | ||
(setq prev-av (send robot :angle-vector)) | ||
(send self :move-hand l/r finger-av 1000) | ||
(when (> (aref finger-av 0) 45) | ||
;; if cylindrical and spherical grasp, move other gripper joints | ||
(send robot l/r :gripper-p :joint-angle -90) | ||
|
@@ -316,7 +236,7 @@ | |
(pushback (send robot :angle-vector) avs) | ||
(send robot :angle-vector prev-av) | ||
(send self :angle-vector-sequence-raw avs) | ||
(send self :wait-interpolation)))))))) | ||
(send self :wait-interpolation))))))) | ||
(:stop-grasp | ||
(&optional (arm :arms) (type :suction)) | ||
(dolist (l/r (if (eq arm :arms) (list :rarm :larm) (list arm))) | ||
|
@@ -474,17 +394,7 @@ | |
(setq rarm-pressure-threshold- (- min-pressure 15)))))) | ||
(send self :stop-grasp arm) | ||
(ros::ros-info "[:calib-pressure-threshold] Threshold r: ~a l: ~a" | ||
rarm-pressure-threshold- larm-pressure-threshold-)) | ||
(:calib-proximity-threshold | ||
(&optional (arm :arms)) | ||
(send self :spin-once) | ||
(dolist (l/r (if (eq arm :arms) (list :rarm :larm) (list arm))) | ||
(let ((hash-table (make-hash-table))) | ||
(sethash :left hash-table (send self :get-proximity l/r :left :raw t)) | ||
(sethash :right hash-table (send self :get-proximity l/r :right :raw t)) | ||
(sethash :middle hash-table (send self :get-proximity l/r :middle :raw t)) | ||
(sethash l/r proximity-init-values- hash-table)) | ||
(setq proximity-threshold- 100)))) ;; TODO decide proper threshold 100 -> ??? | ||
rarm-pressure-threshold- larm-pressure-threshold-))) | ||
|
||
|
||
(defclass jsk_arc2017_baxter::baxter-moveit-environment | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここで左手がエラーになりますね。
すみません、review不足でした。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
エラーになる理由は教えてくれると嬉しいで@pazeshun @708yamaguchi
#2497 で知りたい
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この時代には左手には近接センサがなかったからだと思います
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
うーん、なるほど.それはtravisでは引っ掛けられないなぁ.
となると今出来るのは
euslisp/EusLisp#245
ぐらいかなぁ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あれ?近接なくてもエラーにはならない気がするんだけど....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:get-proximity
でエラーが出ていたと思います。https://github.com/start-jsk/jsk_apc/blob/master/jsk_arc2017_baxter/euslisp/lib/baxter-interface.l#L257-L260
で、左手のtopicが来ていないと全て
nil
が入ります。すると、
https://github.com/start-jsk/jsk_apc/blob/master/jsk_arc2017_baxter/euslisp/lib/baxter-interface.l#L265
で、
expected number
のエラーが出ていたと思います。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:calib-proximity-threshold
の中で、を呼んでいますが、近接センサがないと
let
の変数のproximities
がnil
になり、(elt proximities 0)
がエラーになりました。