Exemple #1
0
#!/usr/bin/env python
from __future__ import print_function
import ecto_pcl
import unittest

class TestPcl(unittest.TestCase):

    def test_import(self):
        print(ecto_pcl)

if __name__ == '__main__':
    import rosunit
    rosunit.rosrun('ecto_pcl', 'test_import', TestPcl)
See README.md
"""

from unittest import TestCase
from sr_sample_python_library.sample_python_class import SamplePythonClass


class TestSamplePythonClass(TestCase):

    def test_get_parameter_name_from_value(self):

        my_convertor = SamplePythonClass()

        param1 = "my_python_param_1"
        param2 = "my_python_param_2"

        expected_value1 = "my_python_param_1_test"
        expected_value2 = "my_python_param_2_test"

        self.assertEqual(expected_value1,
                         my_convertor.get_parameter_name_from_value(param1))

        self.assertEqual(expected_value2,
                         my_convertor.get_parameter_name_from_value(param2))

if __name__ == '__main__':
    import rosunit

    rosunit.rosrun('sr_sample_python_library', 'test_sample_python_class',
                   TestSamplePythonClass)
Exemple #3
0
See README.md
"""

from unittest import TestCase
from sr_sample_python_library.sample_python_class import SamplePythonClass


class TestSamplePythonClass(TestCase):

    def test_get_parameter_name_from_value(self):

        my_convertor = SamplePythonClass()

        param1 = "my_python_param_1"
        param2 = "my_python_param_2"

        expected_value1 = "my_python_param_1_test"
        expected_value2 = "my_python_param_2_test"

        self.assertEqual(expected_value1,
                         my_convertor.get_parameter_name_from_value(param1))

        self.assertEqual(expected_value2,
                         my_convertor.get_parameter_name_from_value(param2))

if __name__ == '__main__':
    import rosunit

    rosunit.rosrun('sr_sample_python_library', 'test_sample_python_class',
                   TestSamplePythonClass)
Exemple #4
0
            baggers=baggers,
            bag=bagname,
        )
        im2mat_rgb = Image2Mat()
        im2mat_depth = Image2Mat()
        counter_rgb = ecto.Counter()
        counter_depth = ecto.Counter()

        graph = [
            bagreader["image"] >> im2mat_rgb["image"],
            bagreader["depth"] >> im2mat_depth["image"],
            im2mat_rgb[:] >> counter_rgb[:],
            im2mat_depth[:] >> counter_depth[:]
        ]

        plasm = ecto.Plasm()
        plasm.connect(graph)
        #ecto.view_plasm(plasm)

        plasm.execute(niter=0)
        print "expecting count:", counts['/camera/rgb/image_color']
        print "RGB count:", counter_rgb.outputs.count
        print "Depth count:", counter_depth.outputs.count
        assert counts['/camera/rgb/image_color'] == counter_rgb.outputs.count
        assert counts['/camera/depth/image'] == counter_depth.outputs.count


if __name__ == "__main__":
    import rosunit
    rosunit.rosrun('ecto_ros', 'test_bag', TestBag)
Exemple #5
0
                                      baggers=baggers,
                                      bag=bagname,
                                    )
        im2mat_rgb = Image2Mat()
        im2mat_depth = Image2Mat()
        counter_rgb = ecto.Counter()
        counter_depth = ecto.Counter()

        graph = [
                  bagreader["image"] >> im2mat_rgb["image"],
                  bagreader["depth"] >> im2mat_depth["image"],
                  im2mat_rgb[:] >> counter_rgb[:],
                  im2mat_depth[:] >> counter_depth[:]

              ]

        plasm = ecto.Plasm()
        plasm.connect(graph)
        #ecto.view_plasm(plasm)

        plasm.execute(niter=0)
        print "expecting count:", counts['/camera/rgb/image_color']
        print "RGB count:", counter_rgb.outputs.count
        print "Depth count:", counter_depth.outputs.count
        assert counts['/camera/rgb/image_color'] == counter_rgb.outputs.count
        assert counts['/camera/depth/image'] == counter_depth.outputs.count

if __name__ == "__main__":
    import rosunit
    rosunit.rosrun('ecto_ros', 'test_bag', TestBag)
Exemple #6
0
#!/usr/bin/env python
from __future__ import print_function
import ecto_pcl
import unittest


class TestPcl(unittest.TestCase):
    def test_import(self):
        print(ecto_pcl)


if __name__ == '__main__':
    import rosunit
    rosunit.rosrun('ecto_pcl', 'test_import', TestPcl)
        robot_heading = 0
        heading_error = self.controller._calc_heading_error(
            self.start_xy, self.next_xy, robot_heading)
        self.assertGreater(heading_error, 0)

        robot_heading = 7 * np.pi / 4
        heading_error = self.controller._calc_heading_error(
            self.start_xy, self.next_xy, robot_heading)
        self.assertGreater(heading_error, 0)

        robot_heading = np.pi / 2
        heading_error = self.controller._calc_heading_error(
            self.start_xy, self.next_xy, robot_heading)
        self.assertLess(heading_error, 0)

        robot_heading = 5 * np.pi / 4 - 5 * np.pi / 180
        heading_error = self.controller._calc_heading_error(
            self.start_xy, self.next_xy, robot_heading)
        self.assertLess(heading_error, 0)

        robot_heading = 5 * np.pi / 4 + 5 * np.pi / 180
        heading_error = self.controller._calc_heading_error(
            self.start_xy, self.next_xy, robot_heading)
        self.assertGreater(heading_error, 0)


if __name__ == '__main__':
    import rosunit
    rosunit.rosrun('repeat_trajectory', 'test_follow_trajectory',
                   TestFollowTrajectoryController)
Exemple #8
0
#!/usr/bin/env python
import ecto
# just to test that the cv_bp import works
from ecto_opencv import cv_bp
from ecto_opencv import calib, features2d, imgproc, highgui
import unittest

class TestListModules(unittest.TestCase):

    def test_list_modules(self):
        ecto.list_ecto_module(features2d)
        ecto.list_ecto_module(highgui)
        ecto.list_ecto_module(calib)
        ecto.list_ecto_module(imgproc)

if __name__ == '__main__':
    import rosunit
    rosunit.rosrun('ecto_opencv', 'test_ecto_opencv', TestListModules)
    def _check_error_log_for_distance_error(message):
        if "Distance between ar_marker_1 and ar_marker_3 is not matching " \
           "appropriate robot marker distances" == message:
            raise Exception(message)

    def test_different_distances_between_frames(self):
        rospy.get_param = TestConstraintsErrors._params_three_frames_mock
        tf2_ros.TransformListener = SimpleMock
        tf2_ros.TransformBroadcaster = SimpleMock
        rospy.Time = SimpleMock
        rospy.Rate = SimpleMock
        rospy.is_shutdown = TestConstraintsErrors._return_false
        tf2_ros.Buffer = BufferMock
        rospy.logerr = \
            TestConstraintsErrors._check_error_log_for_distance_error

        try:
            camera_calibration = CameraCalibration()
            camera_calibration.start()
        except Exception as e:
            self.assertEqual(
                "Distance between ar_marker_1 and ar_marker_3 is not matching "
                "appropriate robot marker distances", e.message,
                "Incorrect validation exception message")


if __name__ == '__main__':
    import rosunit

    rosunit.rosrun(PKG, 'test_constraints_errors', TestConstraintsErrors)