ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Why pursue not stopping after the first message output?

asked 2011-09-16 03:00:41 -0600

sam gravatar image

My code is

 CPL> (top-level
       (pursue
         (format t "First~%")
           (format t "Third~%")
           (format t "Second~%"))
             )

 First
 Third
 Second
 NIL
 CPL>

Why answer is not just 'First'?

Because cram tutorials doc says : 'Only the first form is executed. The other forms are evaporated.'

Thank you~

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2011-09-16 03:18:28 -0600

Lorenz gravatar image

updated 2011-09-16 03:20:43 -0600

Your code is slightly different from that one of the tutorial. The tutorial says:

(top-level
  (pursue
    (format t "First~%")
    (seq
      (sleep 2)
      (format t "Third~%"))
    (seq
      (sleep 1)
      (format t "Second~%"))))

Please note the sleeps. What happens in your case is that all three forms terminate very quickly and pursue doesn't have a chance to evaporate any of the tasks. With the sleeps, you force Third and Second to take long enough to be evaporated.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-09-16 03:00:41 -0600

Seen: 195 times

Last updated: Sep 16 '11