Skip to content

Commit

Permalink
jsk_perception/euslisp/eusmodel_template_gen_utils.l: add :gen-image-…
Browse files Browse the repository at this point in the history
…feature :gen-object-marker to add imagesift and kalman-filtered-objectdetection-marker.l to autogenerated launch files
  • Loading branch information
k-okada committed Jul 19, 2023
1 parent 19184d5 commit 47948b0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
35 changes: 32 additions & 3 deletions jsk_perception/euslisp/eusmodel_template_gen_utils.l
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
(list template-include width height trans)
))))

(defun gen-detection-nodes (obj)
(defun gen-detection-nodes (obj &key remap-args)
(let (nodes)
(setq nodes
(mapcar
Expand All @@ -59,6 +59,7 @@
(setq quat (matrix2quaternion (send trans :rot)))
(instance rosnode :init "jsk_perception" "point_pose_extractor"
:name (format nil "point_pose_extractor_~a" (send obj :name))
:remap_args remap-args
:params
(list
(instance rosparam :init :name "window_name" :value (send obj :name))
Expand All @@ -71,7 +72,17 @@
(send obj :faces)))
(remove nil nodes)))

(defun gen-all-launch (objects launch-file-name &key (ns nil))
(defun gen-all-launch (objects launch-file-name &key (ns nil)
(image-remap-args nil)
(gen-image-feature nil)
(image-topic "image")
(image-topic-transport "raw")
(image-feature-pkg "imagesift") (image-feature-type "imagesift")
(gen-object-marker nil)
(objectdetection-remap-args nil)
(object-builder "(make-cube 60 60 60)")
(object-frame-id "/map")
)
;; generate launchfile
(with-open-file
(launch-f launch-file-name :direction :output)
Expand All @@ -84,7 +95,25 @@
(send obj :name)))
(setq obj-include
(format nil "$(find ~A)/template/_~x_~A.xml" *pkgname* (system::address obj) (send obj :name)))
(setq nodes (gen-detection-nodes obj))
(setq nodes (gen-detection-nodes obj :remap-args image-remap-args))
(if gen-image-feature
(push (instance rosnode :init image-feature-pkg image-feature-type
:name (format nil "~A_~A" image-feature-type (send obj :name))
:remap_args image-remap-args
:params (list (instance rosparam :init :name "image_transport" :value image-topic-transport))
) nodes))
(when gen-object-marker
(let* ((aface (car (mapcan #'(lambda (aface) (if (send aface :get :gl-textureimage) (list aface))) (send obj :faces))))
(tmpl-info (get-template-info obj aface)))
(push (instance rosnode :init "jsk_perception" "kalman-filtered-objectdetection-marker.l"
:name (format nil "objectdetection_marker_~A" (send obj :name))
:remap_args objectdetection-remap-args
:params (list (instance rosparam :init :name "object_builder" :value object-builder)
(instance rosparam :init :name "frame_id" :value object-frame-id)
(instance rosparam :init :name "object_width" :value (* (elt tmpl-info 1) 0.001))
(instance rosparam :init :name "object_height" :value (* (elt tmpl-info 2) 0.001))
)
) nodes)))
(send-all nodes :namespace ns)
(setq xmllist (append (list "launch" nil)
(send-all nodes :list)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(ros::roseus "marker-publish")
(ros::roseus-add-msgs "posedetection_msgs")

(setq *map-id* "/map")
(setq *map-id* (ros::get-param "~frame_id" "/map"))
(setq *solve-tf* t)
(setq *object-width* (ros::get-param "~object_width" 0))
(setq *object-height* (ros::get-param "~object_height" 0))
Expand All @@ -17,7 +17,8 @@
(setq *calc-kalman* t)
(setq *detect-flag* t)
(setq *tf-force* nil)
(setq *target-obj* (make-cube 60 60 60))
(setq *target-obj-code* (read-from-string (ros::get-param "~object_builder" "(make-cube 60 60 60)")))
(setq *target-obj* (eval *target-obj-code*))
(send *target-obj* :reset-coords)
(setf (get *target-obj* :type) (ros::get-param "~target_type" nil))
(setq *map-frame-objectdetection* (instance posedetection_msgs::ObjectDetection :init))
Expand Down Expand Up @@ -122,7 +123,7 @@
(object-name *map-frame-objectdetection*)
(text-name nil) (text-color nil) (obj-color nil))
(let ((mf-obj-lst (send object-name :objects))
(tmp-tgtobj (make-cube 60 60 60))
(tmp-tgtobj (eval *target-obj-code*))
(tp (get target-obj :type)))
(when obj-color
(send tmp-tgtobj :set-color obj-color))
Expand Down Expand Up @@ -164,7 +165,7 @@

(defun catch-outlier (target-obj)
(let ((mf-obj-lst (send *map-frame-objectdetection* :objects))
(tmp-tgtobj (make-cube 60 60 60))
(tmp-tgtobj (eval *target-obj-code*))
(marker-life 700)
(outlierflag nil)
(tp (get target-obj :type)))
Expand Down

0 comments on commit 47948b0

Please sign in to comment.