|
1 | 1 | #!/usr/bin/env roseus
|
2 | 2 |
|
3 |
| -(ros::roseus "simple-screen-point-test") |
4 |
| -(ros::load-ros-package "jsk_recognition_msgs") |
5 |
| -(setq *ray_srv* "/pointcloud_screenpoint_nodelet/screen_to_point") |
| 3 | +(ros::roseus "simple-screen-point-test") |
| 4 | +(ros::load-ros-package "geometry_msgs") |
| 5 | +(setq *pub-topic* "/head_camera/rgb/image_rect_color/screenpoint") |
| 6 | +(setq *sub-topic* "/pointcloud_screenpoint_nodelet/output_point") |
6 | 7 |
|
7 | 8 | (load "package://hrpsys_ros_bridge_tutorials/euslisp/hironxjsk-interface.l")
|
8 | 9 | (hironxjsk-init)
|
|
15 | 16 | (send *ri* :angle-vector (send *hironxjsk* :angle-vector) 1000)
|
16 | 17 | (send *ri* :wait-interpolation))
|
17 | 18 |
|
| 19 | +(defun cb (msg) |
| 20 | + (format t "food coords is ~A ~A ~A ~%" |
| 21 | + (send (send msg :point) :x) |
| 22 | + (send (send msg :point) :y) |
| 23 | + (send (send msg :point) :z))) |
| 24 | + |
| 25 | + |
| 26 | +(ros::advertise *pub-topic* geometry_msgs::PointStamped 1) |
| 27 | +(ros::subscribe *sub-topic* geometry_msgs::PointStamped #'cb) |
| 28 | + |
| 29 | +;; main |
| 30 | + |
18 | 31 | (look-table)
|
19 | 32 |
|
20 | 33 | (let* ((x 240)
|
21 | 34 | (y 320)
|
22 |
| - (req (instance jsk_recognition_msgs::TransformScreenpointRequest :init |
23 |
| - :x x :y y)) |
24 |
| - res) |
| 35 | + (pub-msg (instance geometry_msgs::Pointstamped :init))) |
| 36 | + ;; publish |
25 | 37 | (format t "x y ~A ~A~%" x y)
|
26 |
| - (format t ";;wait for service~%") |
27 |
| - (ros::wait-for-service *ray_srv*) |
28 |
| - (setq res (ros::service-call *ray_srv* req)) |
29 |
| - (format t "food coords is ~A ~A ~A ~%" |
30 |
| - (send (send res :vector) :x) |
31 |
| - (send (send res :vector) :y) |
32 |
| - (send (send res :vector) :z)) |
| 38 | + (send pub-msg :header :stamp (ros::time-now)) |
| 39 | + (send pub-msg :header :frame_id "head_camera_rgb_optical_frame") |
| 40 | + (send (send pub-msg :point) :x x) |
| 41 | + (send (send pub-msg :point) :y y) |
| 42 | + (send (send pub-msg :point) :z 0) |
| 43 | + (ros::publish *pub-topic* pub-msg) |
| 44 | + ;; subscribe |
| 45 | + (unix:usleep (* 100 1000)) |
| 46 | + (ros::spin-once) |
33 | 47 | )
|
34 | 48 |
|
35 | 49 | (ros::exit)
|
0 commit comments