def main(): vel_pub = rospy.Publisher('/dtw_robot1/diff_drive_controller/cmd_vel', Twist, queue_size=10) vel = Twist() pub = rospy.Publisher('chatter3', some_position, queue_size=10) #zahyou pub2 = rospy.Publisher('chatter1', some_position2, queue_size=10) #class #rospy.init_node('talker3', anonymous=True) #rospy.Subscriber('ros_lecture_msgs', Custom2 , queue_size=1) #area_sub = rospy.Subscriber('ros_lecture_msgs', Custom2, queue_size=1) #fps=10 #delay=1/fps #ts = message_filters.ApproximateTimeSynchronizer([sub1,sub2],10,delay) #ts.callback_lambda = lambda x: callback(x, vel, vel_pub) msg = some_position() msg2 = some_position2() callback_lambda = lambda x: callback(x, vel, vel_pub, msg, pub, msg2, pub2) while not rospy.is_shutdown(): rospy.init_node('listener', anonymous=True) #rospy.init_node('kyolo_topic') #sub1=rospy.Subscriber('/darknet_ros/bounding_boxes', BoundingBoxes , callback_lambda) #sub2=rospy.Subscriber('ros_lecture_msgs', Custom2, callback_lambda) rospy.Subscriber('/darknet_ros/bounding_boxes', BoundingBoxes, callback_lambda) #rospy.Subscriber('ros_lecture_msgs', Custom2, callback_lambda) rospy.spin()
def calculate(request): rospy.loginfo('called!') rospy.loginfo(request) #rospy.loginfo(request.a) #rospy.loginfo(request.b) #rospy.loginfo(request.words.split()) #rospy.loginfo(len(request.words.split())) #result = request.a + request.b #position = [sub.position] position = [1, 1, 1] Class = 'Process End!!' #'Detect Started!!' #print sub.position #print sub.Class pub = rospy.Publisher('chatter3', some_position, queue_size=10) r = rospy.Rate(10) # 10hz #while not rospy.is_shutdown(): for num in range(101): msg = some_position() msg.header.stamp = rospy.Time.now() msg.position = [7, 8, 9] pub.publish(msg) r.sleep() return KyoloResponse(position, Class)
def __init__(self): self._vel_pub = rospy.Publisher('/dtw_robot1/diff_drive_controller/cmd_vel', Twist, queue_size=10) self._blue_pub = rospy.Publisher('blue_image', Image, queue_size=20) self._red_pub = rospy.Publisher('red_image', Image, queue_size=20) self._area_pub = rospy.Publisher('chatter2', some_position, queue_size=10) self._image_sub = rospy.Subscriber('camera/rgb/image_raw', Image, self.callback) self._yolo_sub = rospy.Subscriber('/darknet_ros/bounding_boxes', BoundingBoxes , self.call) self._bridge = CvBridge() self._vel = Twist() self._msg = some_position()
def talker(): #チュートリアルのコードからメッセージの型だけ変えてある pub = rospy.Publisher('chatter2', some_position, queue_size=10) rospy.init_node('talker2', anonymous=True) r = rospy.Rate(10) # 10hz while not rospy.is_shutdown(): msg = some_position() #rospyでheaderにタイムスタンプを入れる msg.header.stamp = rospy.Time.now() #適当なデータ msg.position = [4, 5, 6] pub.publish(msg) r.sleep()
def calculate(request): rospy.loginfo('called!') rospy.loginfo('Detect start...') position = [1, 1, 1] Class = 'Process Started' #'Process End!!'#'Detect Started!!' pub = rospy.Publisher('chatter6', some_position, queue_size=10) r = rospy.Rate(10) # 10hz for num in range(10): msg = some_position() msg.header.stamp = rospy.Time.now() msg.position = [7, 8, 9] pub.publish(msg) #r.sleep() ts = message_filters.ApproximateTimeSynchronizer([sub1, sub2], 10, delay) ts.registerCallback(callback) return KyoloResponse(position, Class)
def __init__(self): self._vel_pub = rospy.Publisher( '/dtw_robot1/diff_drive_controller/cmd_vel', Twist, queue_size=10) self._blue_pub = rospy.Publisher('blue_image', Image, queue_size=1) self._red_pub = rospy.Publisher('red_image', Image, queue_size=1) #self._area_pub = rospy.Publisher('ros_lecture_msgs', Custom2, queue_size=1) #self._area_pub = rospy.Publisher('chatter4', some_position, queue_size=10) self._area_pub = rospy.Publisher('chatter2', some_position, queue_size=10) #self._image_sub = rospy.Subscriber('/usb_cam/image_raw', Image, self.callback) #self._image_sub = rospy.Subscriber('/darknet_ros/detection_image', Image, self.callback) self._image_sub = rospy.Subscriber('/dtw_robot1/head_camera/image_raw', Image, self.callback) self._bridge = CvBridge() self._vel = Twist() self._msg = some_position()
def talker(): #チュートリアルのコードからメッセージの型だけ変えてある #pub = rospy.Publisher('ros_lecture_msgs', Custom2, queue_size=10) pub = rospy.Publisher('chatter4', some_position, queue_size=10) rospy.init_node('talker4', anonymous=True) r = rospy.Rate(10) # 10hz while not rospy.is_shutdown(): #msg = Custom2() msg = some_position() #rospyでheaderにタイムスタンプを入れる msg.header.stamp = rospy.Time.now() #適当なデータ msg.position = [7.5, 8.5, 9.5] pub.publish(msg) r.sleep()
def __init__(self): # cv_bridge handles self.cv_bridge = CvBridge() self.person_bbox = BoundingBox() # ROS PARAM self.m_pub_threshold = rospy.get_param('~pub_threshold', 0.40) # Subscribe sub_camera_rgb = rospy.Subscriber('/camera/rgb/image_raw', Image, self.CamRgbImageCallback) sub_camera_depth = rospy.Subscriber('/camera/depth/image_raw', Image, self.CamDepthImageCallback) sub_darknet_bbox = rospy.Subscriber('/darknet_ros/bounding_boxes', BoundingBoxes, self.DarknetBboxCallback) self._pub = rospy.Publisher('depth', some_position, queue_size=10) self._msg = some_position() return