Skip to content

ソフトウェア第一6月17日、PullRequestの宿題です #281

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions dxl_armed_turtlebot/scripts/software_0617_question3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#必要なものを読み込む
import rospy
from opencv_apps.msg import RotatedRectStamped
from image_view2.msg import ImageMarker2
from geometry_msgs.msg import Point

def cb(msg):
print msg.rect #xyz軸方向の長さと角度を変数に持つ楕円。
marker=ImageMarker2() #変数markerにImageMarker2の内容を代入する。
marker.type=0 #typeをcircleに設定。(円を表示するようにする。)
marker.position=Point(msg.rect.center.x,msg.rect.center.y,0) #楕円の中心をマークする。
pub.publish(marker) #markerの内容を発信し、他の機器から受け取れるようにする。

rospy.init_node('client')
rospy.Subscriber('/camshift/track_box',RotatedRectStamped,cb) #/camshift/track_boxを受け取った時にRotatedRectStampedという型のコールバック関数を呼ぶ。
pub=rospy.Publisher('/image_marker',ImageMarker2) #/image_markerを送出する。
rospy.spin() #シャットダウンするまでコールバック関数を呼び続ける。