test_waypoint_set.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright (c) 2016 The UUV Simulator Authors.
3 # All rights reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 import roslib
18 
19 PKG = 'uuv_trajectory_control'
20 roslib.load_manifest(PKG)
21 
22 import sys
23 import unittest
24 from uuv_waypoints import Waypoint, WaypointSet
25 
26 
27 class TestWaypointSet(unittest.TestCase):
28  def test_init(self):
29  wp_set = WaypointSet()
30  self.assertEquals(wp_set.num_waypoints, 0, 'Waypoint list is not empty')
31 
33  wp_set = WaypointSet()
34  self.assertFalse(wp_set.generate_helix(
35  radius=-1.0,
36  center=None,
37  num_points=-1,
38  max_forward_speed=0.0,
39  delta_z=1,
40  num_turns=-1,
41  theta_offset=0.0,
42  heading_offset=0.0), 'Invalid parameters have been wrongly instantiated')
43 
45  wp_set = WaypointSet()
46  self.assertFalse(wp_set.generate_circle(
47  radius=-1,
48  center=None,
49  num_points=-1,
50  max_forward_speed=0,
51  theta_offset=0.0,
52  heading_offset=0.0), 'Invalid parameters have been wrongly instantiated')
53 
55  wp = Waypoint(x=1, y=2, z=3, max_forward_speed=1)
56  wp_set = WaypointSet()
57  self.assertTrue(wp_set.add_waypoint(wp),
58  'Error occured while adding waypoint to empty set')
59  self.assertFalse(wp_set.add_waypoint(wp),
60  'Repeated waypoint wrongfully added')
61 
62 
63 if __name__ == '__main__':
64  import rosunit
65  rosunit.unitrun(PKG, 'test_waypoint_set', TestWaypointSet)


uuv_trajectory_control
Author(s):
autogenerated on Thu Jun 18 2020 03:28:42