Skip to content

Commit e26b441

Browse files
authored
Merge pull request #2 from 708yamaguchi/use-topic
use topic to call PointcloudScreenpoint
2 parents e9a61e2 + 524aabd commit e26b441

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env roseus
22

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")
67

78
(load "package://hrpsys_ros_bridge_tutorials/euslisp/hironxjsk-interface.l")
89
(hironxjsk-init)
@@ -15,21 +16,34 @@
1516
(send *ri* :angle-vector (send *hironxjsk* :angle-vector) 1000)
1617
(send *ri* :wait-interpolation))
1718

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+
1831
(look-table)
1932

2033
(let* ((x 240)
2134
(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
2537
(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)
3347
)
3448

3549
(ros::exit)

hironx_tutorial/launch/hiro_lunch_box.launch

-5
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,12 @@
4343
machine="$(arg cloud_machine)">
4444
<remap from="~points" to="$(arg inpoints)" />
4545
<remap from="~point" to="$(arg image)/$(arg image_type)/screenpoint" />
46-
<remap from="~rect" to="$(arg image)/$(arg image_type)/screenrectangle" />
47-
<remap from="~point_array" to="$(arg image)/$(arg image_type)/screenpoint_array" />
4846
<rosparam>
49-
always_subscribe: true
5047
queue_size: 10
5148
crop_size: 10
5249
search_size: 16
53-
publish_point: true
5450
</rosparam>
5551
<param name="use_sync" value="$(arg USE_SYNC)" />
56-
<param name="publish_points" value="$(arg PUBLISH_POINTS)" />
5752
</node>
5853

5954

0 commit comments

Comments
 (0)