|
32 | 32 | # @todo split all this into libraries
|
33 | 33 | from __future__ import print_function
|
34 | 34 |
|
35 |
| -import rospy |
36 | 35 | import roslib
|
37 | 36 | import roslib.msgs
|
38 | 37 | import rosbag
|
@@ -426,19 +425,18 @@ def __init__(self, bags, topics, plot_arrays=True, plot_headers=True, plot_forma
|
426 | 425 |
|
427 | 426 | # @todo support multiple bags, for now we take the first one only
|
428 | 427 | if len(self._bags) > 1:
|
429 |
| - rospy.logwarn("Does NOT support multiple bags yet! Only first bag will be used.") |
| 428 | + print("Does NOT support multiple bags yet! Only first bag will be used.", file=sys.stderr) |
430 | 429 | bag = self._bags[0]
|
431 | 430 |
|
432 |
| - rospy.loginfo("Processing %s ..." % bag) |
| 431 | + print("Processing %s ..." % bag) |
433 | 432 |
|
434 | 433 | # Retrieve/Expand plottable topic fields:
|
435 | 434 | plottable_topics = []
|
436 | 435 | for topic in topics:
|
437 | 436 | plottable_topics += self.get_plot_fields(topic)[0]
|
438 | 437 |
|
439 | 438 | if len(plottable_topics) == 0:
|
440 |
| - rospy.logwarn("No topic/field can be plotted!") |
441 |
| - rospy.signal_shutdown("No topic/field can be plotted!") |
| 439 | + print("No topic/field can be plotted!", file=sys.stderr) |
442 | 440 | return
|
443 | 441 |
|
444 | 442 | # Create topic evaluators:
|
@@ -478,12 +476,10 @@ def __init__(self, bags, topics, plot_arrays=True, plot_headers=True, plot_forma
|
478 | 476 |
|
479 | 477 | times[topic].append(time.to_sec())
|
480 | 478 | except IOError as e:
|
481 |
| - rospy.logerr('Failed to open bag file %s: %s!' % (bag, e.strerror)) |
482 |
| - rospy.signal_shutdown('Failed to open bag file %s: %s!' % (bag, e.strerror)) |
| 479 | + print('Failed to open bag file %s: %s!' % (bag, e.strerror), file=sys.stderr) |
483 | 480 | return
|
484 | 481 | except rosbag.ROSBagException as e:
|
485 |
| - rospy.logerr('Failed to read bag file %s: %s!' % (bag, e.message)) |
486 |
| - rospy.signal_shutdown('Failed to read bag file %s: %s!' % (bag, e.message)) |
| 482 | + print('Failed to read bag file %s: %s!' % (bag, e.message), file=sys.stderr) |
487 | 483 | return
|
488 | 484 |
|
489 | 485 | min_time = []
|
@@ -517,7 +513,7 @@ def __init__(self, bags, topics, plot_arrays=True, plot_headers=True, plot_forma
|
517 | 513 |
|
518 | 514 | plt.close(fig)
|
519 | 515 | except OverflowError as e:
|
520 |
| - rospy.logerr('Failed to save plot as %s image file (try other format, e.g. svg): %s', self._plot_format, e.message) |
| 516 | + print('Failed to save plot as %s image file (try other format, e.g. svg): %s', self._plot_format, e.message, file=sys.stderr) |
521 | 517 |
|
522 | 518 | def get_plot_fields(self, topic_name):
|
523 | 519 | """
|
@@ -598,8 +594,6 @@ def get_plot_fields(self, topic_name):
|
598 | 594 |
|
599 | 595 |
|
600 | 596 | if __name__ == "__main__":
|
601 |
| - rospy.init_node('plot', anonymous=True) |
602 |
| - |
603 | 597 | parser = argparse.ArgumentParser(
|
604 | 598 | description='Plots a list of topics into a single axis. '
|
605 | 599 | 'All the numeric fields are plotted in different series. '
|
|
0 commit comments