Skip to content

Commit 55cbde3

Browse files
committed
[joints] started on the joint state monitoring action
1 parent c32f601 commit 55cbde3

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

cram_external_interfaces/cram_joint_states/cram-joint-states.asd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@
4141
((:module "src"
4242
:components
4343
((:file "package")
44-
(:file "joint-states" :depends-on ("package"))))))
44+
(:file "joint-states" :depends-on ("package"))
45+
(:file "monitoring" :depends-on ("package" "joint-states"))))))
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
;;;
2+
;;; Copyright (c) 2020, Gayane Kazhoyan <[email protected]>
3+
;;; All rights reserved.
4+
;;;
5+
;;; Redistribution and use in source and binary forms, with or without
6+
;;; modification, are permitted provided that the following conditions are met:
7+
;;;
8+
;;; * Redistributions of source code must retain the above copyright
9+
;;; notice, this list of conditions and the following disclaimer.
10+
;;; * Redistributions in binary form must reproduce the above copyright
11+
;;; notice, this list of conditions and the following disclaimer in the
12+
;;; documentation and/or other materials provided with the distribution.
13+
;;; * Neither the name of the Institute for Artificial Intelligence/
14+
;;; Universitaet Bremen nor the names of its contributors may be used to
15+
;;; endorse or promote products derived from this software without
16+
;;; specific prior written permission.
17+
;;;
18+
;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
;;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22+
;;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23+
;;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24+
;;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26+
;;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
;;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28+
;;; POSSIBILITY OF SUCH DAMAGE.
29+
30+
(in-package :joints)
31+
32+
(defun monitor-joint-state (joint-name comparison-function)
33+
(unless joint-name
34+
(setf joint-name "r_gripper_joint"))
35+
(unless comparison-function
36+
(setf comparison-function (lambda (joint-angle) (< joint-angle 0.002))))
37+
(cpl:wait-for
38+
(cpl:fl-funcall (lambda (joint-state-msg-fluent)
39+
(funcall comparison-function
40+
(car (joints:joint-positions
41+
(list joint-name)
42+
joint-state-msg-fluent))))
43+
*robot-joint-states-msg*))
44+
(print "DONE"))

0 commit comments

Comments
 (0)