def __init__(self, robot_pose, robot_info, options = None): """Create controllers and the state transitions""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) self.extgoal = False if options is not None: try: self.parameters.goal.x = options.x self.parameters.goal.y = options.y self.extgoal = True except Exception: pass # Fill in some parameters self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] self.parameters.ir_max = robot_info.ir_sensors.rmax self.parameters.direction = 'left' self.parameters.distance = 0.2 self.robot = robot_info # generate global path self.parameters.ga_path = ga.ga_execute((0,0), (self.parameters.goal.x, self.parameters.goal.y)) self.parameters.ga_path.append((self.parameters.goal.x, self.parameters.goal.y)) global global_cnt global_cnt = len(self.parameters.ga_path) point_cnt = self.parameters.point_cnt #print self.parameters.ga_path, "ga_path" #Add controllers self.avoidobstacles = self.create_controller('AvoidObstacles', self.parameters) self.gtg = self.create_controller('GoToGoal', self.parameters) self.hold = self.create_controller('Hold', None) self.wall = self.create_controller('FollowWall', self.parameters) self.path = self.create_controller('FollowPath', self.parameters) self.blending = self.create_controller("Blending", self.parameters) # Define transitions self.add_controller(self.hold, (lambda: not self.at_goal(), self.gtg)) self.add_controller(self.gtg, (self.at_goal, self.hold), (self.at_obstacle, self.avoidobstacles)) self.add_controller(self.avoidobstacles, (self.at_goal, self.hold), (self.free, self.path) ) # self.add_controller(self.blending, # (self.at_goal, self.hold), # (self.free, self.path), # (self.at_obstacle, self.avoidobstacles), # ) self.add_controller(self.path, (lambda: self.next_point(), self.path), (self.at_goal, self.hold), #(lambda: self.parameters.point_cnt == len(self.parameters.ga_path) - 1 and not self.next_point(), self.gtg), (self.at_obstacle, self.avoidobstacles)) self.current = self.path
def __init__(self, robot_pose, robot_info, options=None): """Create controllers and the state transitions""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) self.extgoal = False if options is not None: try: self.parameters.goal.x = options.x self.parameters.goal.y = options.y self.extgoal = True except Exception: pass # Fill in some parameters self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] self.parameters.ir_max = robot_info.ir_sensors.rmax self.parameters.direction = 'left' self.parameters.distance = 0.2 self.robot = robot_info # generate global path self.parameters.ga_path = ga.ga_execute( (0, 0), (self.parameters.goal.x, self.parameters.goal.y)) self.parameters.ga_path.append( (self.parameters.goal.x, self.parameters.goal.y)) global global_cnt global_cnt = len(self.parameters.ga_path) point_cnt = self.parameters.point_cnt #print self.parameters.ga_path, "ga_path" #Add controllers self.avoidobstacles = self.create_controller('AvoidObstacles', self.parameters) self.gtg = self.create_controller('GoToGoal', self.parameters) self.hold = self.create_controller('Hold', None) self.wall = self.create_controller('FollowWall', self.parameters) self.path = self.create_controller('FollowPath', self.parameters) self.blending = self.create_controller("Blending", self.parameters) # Define transitions self.add_controller(self.hold, (lambda: not self.at_goal(), self.gtg)) self.add_controller(self.gtg, (self.at_goal, self.hold), (self.at_obstacle, self.avoidobstacles)) self.add_controller(self.avoidobstacles, (self.at_goal, self.hold), (self.free, self.path)) # self.add_controller(self.blending, # (self.at_goal, self.hold), # (self.free, self.path), # (self.at_obstacle, self.avoidobstacles), # ) self.add_controller( self.path, (lambda: self.next_point(), self.path), (self.at_goal, self.hold), #(lambda: self.parameters.point_cnt == len(self.parameters.ga_path) - 1 and not self.next_point(), self.gtg), (self.at_obstacle, self.avoidobstacles)) self.current = self.path
def __init__(self, robot_pose, robot_info): """Create the controller""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) self.jcontroller = self.create_controller('joystick.JoystickController', \ (self.parameters.joystick, robot_info.wheels.max_velocity*robot_info.wheels.radius, robot_info.wheels.max_velocity*robot_info.wheels.radius/robot_info.wheels.base_length)) self.current = self.jcontroller
def __init__(self, robot_pose, robot_info): """Create the controller""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) self.jcontroller = self.create_controller('joystick.JoystickController', \ (self.parameters.joystick, robot_info.wheels.max_velocity*robot_info.wheels.radius, robot_info.wheels.max_velocity*robot_info.wheels.radius/robot_info.wheels.base_length)) self.current = self.jcontroller
def __init__(self, robot_pose, robot_info, options = None): """Create controllers and the state transitions""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) self.extgoal = False if options is not None: try: self.parameters.goal.x = options.x self.parameters.goal.y = options.y self.extgoal = True except Exception: pass # Fill in some parameters self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] self.parameters.ir_max = robot_info.ir_sensors.rmax self.parameters.direction = 'left' self.parameters.distance = 0.2 self.robot = robot_info #Add controllers self.avoidobstacles = self.create_controller('AvoidObstacles', self.parameters) self.gtg = self.create_controller('GoToGoal', self.parameters) self.wall = self.create_controller('FollowWall', self.parameters) self.hold = self.create_controller('Hold', None) self.gs = self.create_controller('GoStraight', None) # Week 7 Assignment: # Define transitions self.add_controller(self.hold, (lambda: not self.at_goal(), self.gtg)) self.add_controller(self.gtg, (self.at_goal, self.hold), (self.at_obstacle, self.avoidobstacles)) self.add_controller(self.avoidobstacles, (self.at_goal, self.hold), (self.free, self.gtg), ) # Change and add additional transitions self.add_controller(self.gs, (self.at_obstacle, self.wall) ) self.add_controller(self.wall, (self.at_goal, self.hold) ) # End Week 7 # Start in the 'go-to-goal' state #self.current = self.gtg self.current = self.gs
def __init__(self, robot_pose, robot_info): """Create the controller""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) # Fill in poses for the controller self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] # Create the controller self.avoidobstacles = self.create_controller('week4.AvoidObstacles', self.parameters) # Set the controller self.current = self.avoidobstacles
def __init__(self, robot_pose, robot_info): """Create the controller""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) # Create the tracker self.tracker = Path(robot_pose, 0) # Create the controller self.gtg = self.create_controller('week3.GoToGoal', self.parameters) # Set the controller self.current = self.gtg
def __init__(self, robot_pose, robot_info): """Create the controller""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) # Create the tracker self.tracker = Path(robot_pose, 0) # Create the controller self.gtg = self.create_controller('week3.GoToGoal', self.parameters) # Set the controller self.current = self.gtg
def __init__(self, robot_pose, robot_info): """Create the controller""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) # Fill in poses for the controller self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] # Create the controller self.blending = self.create_controller('week5.Blending', self.parameters) # Set the controller self.current = self.blending
def __init__(self, robot_pose, robot_info): """Create the controller""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) # Fill in poses for the controller self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] # Create the controller self.blending = self.create_controller('week5.Blending', self.parameters) # Set the controller self.current = self.blending
def __init__(self, robot_pose, robot_info, options=None): """Create controllers and the state transitions""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) self.extgoal = False if options is not None: try: self.parameters.goal.x = options.x self.parameters.goal.y = options.y self.extgoal = True except Exception: pass # Fill in some parameters self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] self.parameters.ir_max = robot_info.ir_sensors.rmax self.parameters.direction = 'left' self.parameters.distance = 0.2 self.robot = robot_info #Add controllers self.avoidobstacles = self.create_controller('AvoidObstacles', self.parameters) self.gtg = self.create_controller('GoToGoal', self.parameters) self.wall = self.create_controller('FollowWall', self.parameters) self.hold = self.create_controller('Hold', None) # Week 7 Assignment: # Define transitions self.add_controller(self.hold, (lambda: not self.at_goal(), self.gtg)) self.add_controller(self.gtg, (self.at_goal, self.hold), (self.at_obstacle, self.avoidobstacles)) self.add_controller( self.avoidobstacles, (self.at_goal, self.hold), (self.free, self.gtg), ) # Change and add additional transitions # End Week 7 # Start in the 'go-to-goal' state self.current = self.gtg
def __init__(self, robot_pose, robot_info, options = None): """Create the controller""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) if options is not None: try: self.parameters.direction = options.direction self.parameters.velocity.v = options.velocity self.parameters.gains = options.gains except: pass # Fill in poses for the controller self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] # Create and set the controller self.current = self.create_controller('week6.FollowWall', self.parameters)
def __init__(self, robot_pose, robot_info): """Create controllers and the state transitions""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) # Fill in poses for the controller self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] # Add controllers self.gtg = self.create_controller('gotogoal.GoToGoal', self.parameters) self.hold = self.create_controller('hold.Hold', None) # Transitions if at goal/obstacle self.add_controller(self.hold, (lambda: not self.at_goal(), self.gtg)) self.add_controller(self.gtg, (self.at_goal, self.hold)) # Start in the 'go-to-goal' state self.current = self.gtg
def __init__(self, robot_pose, robot_info): """Create controllers and the state transitions""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) # Fill in poses for the controller self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] # Add controllers self.gtg = self.create_controller('gotogoal.GoToGoal', self.parameters) self.hold = self.create_controller('hold.Hold', None) # Transitions if at goal/obstacle self.add_controller(self.hold, (lambda : not self.at_goal(), self.gtg)) self.add_controller(self.gtg, (self.at_goal, self.hold)) # Start in the 'go-to-goal' state self.current = self.gtg
def __init__(self, robot_pose, robot_info, options=None): """Create the controller""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) if options is not None: try: self.parameters.direction = options.direction self.parameters.velocity.v = options.velocity self.parameters.gains = options.gains except: pass # Fill in poses for the controller self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] # Create and set the controller self.current = self.create_controller('week6.FollowWall', self.parameters)
def __init__(self, robot_pose, robot_info): """Create necessary controllers""" QuickBotSupervisor.__init__(self, robot_pose, robot_info) # Fill in poses for the controller self.parameters.sensor_poses = robot_info.ir_sensors.poses[:] # Create the controllers self.avoidobstacles = self.create_controller('AvoidObstacles', self.parameters) self.gtg = self.create_controller('GoToGoal', self.parameters) self.hold = self.create_controller('Hold', None) # Create some state transitions self.add_controller(self.hold) self.add_controller(self.gtg, \ (self.at_goal, self.hold), \ (self.at_obstacle, self.avoidobstacles)) # Week 5 Assigment code should go here # End Week 5 Assignment # Start in 'go-to-goal' state self.current = self.gtg