示例#1
0
    def spin(self):
        time.sleep(1.0)
        started = time.time()
        counter = 0
        cvim = cv.CreateImage((640, 480), cv.IPL_DEPTH_8U, 1)
        ball_xv = 10
        ball_yv = 10
        ball_x = 100
        ball_y = 100

        cvb = CvBridge()

        while not rospy.core.is_shutdown():

            cv.Set(cvim, 0)
            cv.Circle(cvim, (ball_x, ball_y), 10, 255, -1)

            ball_x += ball_xv
            ball_y += ball_yv
            if ball_x in [10, 630]:
                ball_xv = -ball_xv
            if ball_y in [10, 470]:
                ball_yv = -ball_yv

            self.pub.publish(cvb.cv_to_imgmsg(cvim))

            time.sleep(0.03)
示例#2
0
  def spin(self):
    time.sleep(1.0)
    started = time.time()
    counter = 0
    cvim = cv.CreateImage((640,480), cv.IPL_DEPTH_8U, 1)
    ball_xv = 10
    ball_yv = 10
    ball_x = 100
    ball_y = 100

    cvb = CvBridge()

    while not rospy.core.is_shutdown():

      cv.Set(cvim, 0)
      cv.Circle(cvim, (ball_x, ball_y), 10, 255, -1)

      ball_x += ball_xv
      ball_y += ball_yv
      if ball_x in [10, 630]:
        ball_xv = -ball_xv
      if ball_y in [10, 470]:
        ball_yv = -ball_yv

      self.pub.publish(cvb.cv_to_imgmsg(cvim))

      time.sleep(0.03)
示例#3
0
 def spin(self):
     time.sleep(1.0)
     cvb = CvBridge()
     while not rospy.core.is_shutdown():
         cvim = cv.LoadImage(self.filenames[0])
         self.pub.publish(cvb.cv_to_imgmsg(cvim))
         self.filenames = self.filenames[1:] + [self.filenames[0]]
         time.sleep(1)
示例#4
0
 def spin(self):
   time.sleep(1.0)
   cvb = CvBridge()
   while not rospy.core.is_shutdown():
     cvim = cv.LoadImage(self.filenames[0])
     self.pub.publish(cvb.cv_to_imgmsg(cvim))
     self.filenames = self.filenames[1:] + [self.filenames[0]]
     time.sleep(1)