Example #1
0
class System:
    def __init__(self):
        print('Hello')
        self.robot = Robot()
        # self.camera = Camera()
        rospy.Subscriber("/key_vel", Twist, self.keyCallback, queue_size=10)

    def keyCallback(self, data):

        if data.angular.z > 0:
            self.robot.left()
        elif data.angular.z < 0:
            self.robot.right()
        elif data.linear.x > 0:
            self.robot.down()
        elif data.linear.x < 0:
            self.robot.up()
Example #2
0
def main():
    # We need to initalize ROS environment for Robot and camera to connect/communicate
    ROSEnvironment()
    # Initalize robot
    robot = Robot()
    # Start robot
    robot.start()

    robot.center()
    time.sleep(1)

    #TODO: change the values in left
    robot.left(0.2)
    time.sleep(1)#wait a second

    #TODO: change the values in right
    robot.right(0.2)
    time.sleep(1)