-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jsk_rosbag_tools] Split test to avoid indigo's error
- Loading branch information
Showing
5 changed files
with
80 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env python | ||
|
||
import os.path as osp | ||
import subprocess | ||
import unittest | ||
|
||
import rospkg | ||
import rospy | ||
|
||
|
||
PKG = 'jsk_rosbag_tools' | ||
NAME = 'test_bag_to_video' | ||
|
||
|
||
class TestBagToVideo(unittest.TestCase): | ||
|
||
def _check_command(self, cmd): | ||
proc = subprocess.Popen(cmd, shell=True, | ||
stdout=subprocess.PIPE) | ||
with proc.stdout: | ||
for line in iter(proc.stdout.readline, b''): | ||
rospy.loginfo('{}'.format(line.decode('utf-8').strip())) | ||
returncode = proc.wait() | ||
|
||
if returncode != 0: | ||
raise RuntimeError('command {} failed.'.format(cmd)) | ||
|
||
def test_bag_to_video_and_video_to_bag_and_compress(self): | ||
rospack = rospkg.RosPack() | ||
path = rospack.get_path('jsk_rosbag_tools') | ||
|
||
output_dir = osp.join(path, 'tests', 'output', 'audio') | ||
audio_bag_path = osp.join(path, 'samples', 'data', | ||
'2022-05-07-hello-test.bag') | ||
|
||
cmd = 'rosrun jsk_rosbag_tools bag_to_video.py {} -o {}'.format( | ||
audio_bag_path, output_dir) | ||
self._check_command(cmd) | ||
|
||
output_dir = osp.join(path, 'tests', 'output', 'video') | ||
video_bag_path = osp.join(path, 'samples', 'data', | ||
'20220530173950_go_to_kitchen_rosbag.bag') | ||
cmd = 'rosrun jsk_rosbag_tools bag_to_video.py {} -o {}'.format( | ||
video_bag_path, output_dir) | ||
self._check_command(cmd) | ||
|
||
# video_to_bag.py test | ||
video_path = osp.join( | ||
output_dir, | ||
'head_camera--slash--rgb--slash--throttled' | ||
'--slash--image_rect_color--slash--compressed.mp4') | ||
output_filename = osp.join(path, 'tests', 'output', 'video_to_bag.bag') | ||
cmd = 'rosrun jsk_rosbag_tools video_to_bag.py {} ' \ | ||
'--out {} --no-progress-bar'.format( | ||
video_path, output_filename) | ||
self._check_command(cmd) | ||
|
||
# compress_imgs.py test | ||
cmd = 'rosrun jsk_rosbag_tools compress_imgs.py {} ' \ | ||
'--no-progress-bar'.format(output_filename) | ||
self._check_command(cmd) | ||
|
||
|
||
if __name__ == '__main__': | ||
import rostest | ||
rostest.rosrun(PKG, NAME, TestBagToVideo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" ?> | ||
<launch> | ||
|
||
<test test-name="test_bag_to_video" pkg="jsk_rosbag_tools" type="test_bag_to_video.py" | ||
time-limit="360.0" /> | ||
|
||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" ?> | ||
<launch> | ||
|
||
<test test-name="test_bag_to_video" pkg="jsk_rosbag_tools" type="test_jsk_rosbag_tools.py" | ||
<test test-name="test_jsk_rosbag_tools" pkg="jsk_rosbag_tools" type="test_jsk_rosbag_tools.py" | ||
time-limit="360.0" /> | ||
|
||
</launch> |