class TestPerson(unittest.TestCase): def setUp(self): rospy.init_node('test_person') self.person = Person('robot_0', 2, 0.5, 0, 0, 0) self.boundaries = locations.get_orchard_boundaries() def test_init(self): """Checks if attributes are set correctly after init. Values are based on world_locations files.""" person = self.person self.assertEquals(person.counter, 0) self.assertEquals(person.min_x, -35) self.assertEquals(person.max_x, 35) self.assertEquals(person.min_y, -60) self.assertEquals(person.max_y, 60) def test_execute_callback(self): """Checks to see if action queue has action and counter has incremented accordingly.""" self.person.execute_callback() self.assertEquals(self.person.counter, 1) self.assertIsNot(len(self.person._action_queue), 0)
#!/usr/bin/env python import rospy from robots import Robot, Animal, Person, DifferentRobot, PickerRobot, CarrierRobot, Bin, Tractor, EducatedPerson from actions import MoveAction, RotateAction, NavigateAction, Figure8Action, MoveRandomAction import robot_storage from math import pi """Main file for initializing and executing the robots of the orchard simulator.""" rospy.init_node("main") animal = Animal("robot_0", 2, 0.5, 20.5, 0, 0) person1 = Person("robot_1", 2, 0.5, 0, 45, 0) person2 = EducatedPerson("robot_2", 2, 0.5, -20.5, 0, 0) tractor = Tractor("robot_3", 2, 0.9, -20.5, 45, 0) binbot1 = Bin("robot_4", 3, 0.5, -8.75, -39, pi / 2) binbot2 = Bin("robot_5", 3, 0.5, -1.75, -39, pi / 2) binbot3 = Bin("robot_6", 3, 0.5, 1.75, -39, pi / 2) binbot4 = Bin("robot_7", 3, 0.5, 5.25, -39, pi / 2) picker1 = PickerRobot("robot_8", 3, 0.5, -8.75, -44, 0) picker2 = PickerRobot("robot_9", 3, 0.5, 1, -44, 0) picker3 = PickerRobot("robot_10", 3, 0.5, 7, -44, 0) carrier1 = CarrierRobot("robot_11", 3, 0.5, 35.5, -25, 0) carrier2 = CarrierRobot("robot_12", 2, 0.5, 41.5, -35, 0)
def setUp(self): rospy.init_node('test_person') self.person = Person('robot_0', 2, 0.5, 0, 0, 0) self.boundaries = locations.get_orchard_boundaries()
#!/usr/bin/env python import rospy from robots import Robot, Animal, Person, DifferentRobot, PickerRobot, CarrierRobot, Bin, Tractor, EducatedPerson from actions import MoveAction, RotateAction, NavigateAction, Figure8Action, MoveRandomAction import robot_storage from math import pi """Main file for initializing and executing the robots of the orchard simulator.""" rospy.init_node('main') animal = Animal('robot_0', 2, 0.5, 20.5, 0, 0) person1 = Person('robot_1', 2, 0.5, 0, 45, 0) person2 = EducatedPerson('robot_2', 2, 0.5, -20.5, 0, 0) tractor = Tractor('robot_3', 2, 0.9, -20.5, 45, 0) binbot1 = Bin('robot_4', 3, 0.5, -8.75, -39, pi/2) binbot2 = Bin('robot_5', 3, 0.5, -1.75, -39, pi/2) binbot3 = Bin('robot_6', 3, 0.5, 1.75, -39, pi/2) binbot4 = Bin('robot_7', 3, 0.5, 5.25, -39, pi/2) picker1 = PickerRobot('robot_8', 3, 0.5, -8.75, -44, 0) picker2 = PickerRobot('robot_9', 3, 0.5, 1, -44, 0) picker3 = PickerRobot('robot_10', 3, 0.5, 7, -44, 0) carrier1 = CarrierRobot('robot_11', 3, 0.5, 35.5, -25, 0) carrier2 = CarrierRobot('robot_12', 2, 0.5, 41.5, -35, 0)