Esempio n. 1
0
    def __sendPoseToBase_shuffle(self, distanceInCentimeters):
        currentPose = Robot.getCurrentPose()

        deltaY = math.sin(math.radians(currentPose[2])) * distanceInCentimeters
        deltaX = math.cos(math.radians(currentPose[2])) * distanceInCentimeters

        Robot.setCurrentPose((currentPose[0] + deltaX, currentPose[1] - deltaY, currentPose[2]))
Esempio n. 2
0
    def relativeShuffle(self, distance, relativeAngle):
        currentPose = Robot.getCurrentPose()
        currentAngle = currentPose[2]
        B = 360 - currentAngle - relativeAngle

        deltaX = distance * math.sin(math.radians(B))
        deltaY = distance * math.cos(math.radians(B))

        destination = (currentPose[0] + deltaX, currentPose[1] + deltaY, currentAngle)

        self.doShuffleMovement([currentPose, destination], currentAngle)
Esempio n. 3
0
    def doSnakeMovement(self, destination, finalAbsoluteAngle):
        path = self.__buildPath(destination)

        moves = SnakeMovementPlanner().planMovement(Robot.getCurrentPose(), path, finalAbsoluteAngle)

        print "snake moves:"
        print moves

        self.executeMoves(moves)

        Robot.setCurrentPose((destination[0], destination[1], finalAbsoluteAngle))
Esempio n. 4
0
    def doShuffleMovement(self, path, finalAbsoluteAngle):
        print "about to delete first node on shuffle path..."
        print "node to delete is: " + str(path[0])
        del path[0] # path[0] is the current robot's pose

        print "planning shuffle movement..."
        moves = ShuffleMovementPlanner().planMovement(Robot.getCurrentPose(), path)

        print "about to execute shuffle moves..."
        print moves

        self.executeMoves(moves)

        lastNode = path[len(path) - 1]
        Robot.setCurrentPose((lastNode[0], lastNode[1], finalAbsoluteAngle))
Esempio n. 5
0
    def __acquireCurrentPose(self):
        poseAcquired = False
        pose = ()

        while not poseAcquired:
            try:
                pose = self.cam.getCurrentPose()
                poseAcquired = True
                break
            except ValueError:
                print "rotating of 5 degrees..."
                self.robotMover.doRelativeRotation(5)

        Robot.setCurrentPose(pose)

        print "Current robot pose is: " + str(Robot.getCurrentPose())
Esempio n. 6
0
    def doRelativeRotation(self, relativeAngleInDegrees):
        currentPose = Robot.getCurrentPose()

        self.positionController.rotate(relativeAngleInDegrees)

        Robot.setCurrentPose((currentPose[0], currentPose[1], currentPose[2] + relativeAngleInDegrees))
Esempio n. 7
0
    def __sendPoseToBase_rotate(self, angleInDegrees):
        currentPose = Robot.getCurrentPose()

        Robot.setCurrentPose((currentPose[0], currentPose[1], currentPose[2] + angleInDegrees))
Esempio n. 8
0
    def __adjustPosition(self, distance, verticalDrift):
        ancientPose = Robot.getCurrentPose()

        newPose = (ancientPose[0] - (int(distance)/10), ancientPose[1] + verticalDrift, ancientPose[2])

        Robot.setCurrentPose(newPose)