예제 #1
0
class TestBin(unittest.TestCase):
    def setUp(self):
        rospy.init_node('test_bin')
        self.bin = Bin('robot_0', 1, 0.5, 1, 1, pi / 2)
        self.robot = Robot('robot_1', 1, 0.5, 1, 1, pi / 2)

    def test_init(self):
        """Checks that bin attributes are correctly initialised."""
        self.assertEquals(self.bin.slow_down_counter, 0)
        self.assertTrue(self.bin.is_publishing, True)
        self.assertTrue(self.bin.is_empty, True)
        self.assertFalse(self.bin.is_carried, False)
        self.assertIsNone(self.bin.designated_picker)
        self.assertIsNone(self.bin.master)
        self.assertIsNone(self.bin.should_face)
        self.assertIsNotNone(self.bin.bin_latch)

    def test_latch_sets_master(self):
        """Checks that the latch function sets the bin's master to robot."""
        self.bin.latch(self.robot)
        self.assertEquals(self.bin.master.robot_id, self.robot.robot_id)

    def test_latch_stops_robot(self):
        """Checks that the latch function stops the robot it latches to."""
        self.bin.latch(self.robot)
        self.assertEquals(self.robot.velocity.linear.x, 0)
        self.assertFalse(self.robot.rotation_executing, False)

    def test_latch_sets_should_face(self):
        """Checks if latch function sets the should_face attribute."""
        self.bin.latch(self.robot)
        self.assertEquals(self.bin.should_face, pi / 2)
예제 #2
0
class TestBin(unittest.TestCase):

    def setUp(self):
        rospy.init_node('test_bin')
        self.bin = Bin('robot_0', 1, 0.5, 1, 1, pi/2)
        self.robot = Robot('robot_1', 1, 0.5, 1, 1, pi/2)
        

    def test_init(self):
        """Checks that bin attributes are correctly initialised."""
        self.assertEquals(self.bin.slow_down_counter, 0)
        self.assertTrue(self.bin.is_publishing, True)
        self.assertTrue(self.bin.is_empty, True) 
        self.assertFalse(self.bin.is_carried, False)
        self.assertIsNone(self.bin.designated_picker)
        self.assertIsNone(self.bin.master)
        self.assertIsNone(self.bin.should_face)
        self.assertIsNotNone(self.bin.bin_latch)

    def test_latch_sets_master(self):
        """Checks that the latch function sets the bin's master to robot."""
        self.bin.latch(self.robot)
        self.assertEquals(self.bin.master.robot_id, self.robot.robot_id)

    def test_latch_stops_robot(self):
        """Checks that the latch function stops the robot it latches to."""
        self.bin.latch(self.robot)
        self.assertEquals(self.robot.velocity.linear.x, 0)
        self.assertFalse(self.robot.rotation_executing, False)

    def test_latch_sets_should_face(self):
        """Checks if latch function sets the should_face attribute."""
        self.bin.latch(self.robot)
        self.assertEquals(self.bin.should_face, pi/2)
예제 #3
0
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)


# Add all robots to robot_storage.
robot_storage.addRobot(animal, "robot_0")
robot_storage.addRobot(person1, "robot_1")
예제 #4
0
 def setUp(self):
     rospy.init_node('test_bin')
     self.bin = Bin('robot_0', 1, 0.5, 1, 1, pi / 2)
     self.robot = Robot('robot_1', 1, 0.5, 1, 1, pi / 2)
예제 #5
0
파일: main.py 프로젝트: xiekaren/SpeedKiwi
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)



# Add all robots to robot_storage.
robot_storage.addRobot(animal, "robot_0")
예제 #6
0
 def setUp(self):
     rospy.init_node('test_bin')
     self.bin = Bin('robot_0', 1, 0.5, 1, 1, pi/2)
     self.robot = Robot('robot_1', 1, 0.5, 1, 1, pi/2)