Exemplo n.º 1
0
    def __init__(self, robot_pose, robot_info):
        """Create controllers and the state transitions"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        # The maximal distance to an obstacle (inexact)
        self.distmax = robot_info.ir_sensors.rmax + robot_info.wheels.base_length / 2

        # 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 = self.distmax * 0.85
        self.parameters.path = [(1.0, 0.5), (0.5, 1.0)]
        self.process_state_info(robot_info)

        #Add controllers
        self.movingtopoint1 = self.create_controller('MovingToPoint1',
                                                     self.parameters)
        self.movingtopoint2 = self.create_controller('MovingToPoint2',
                                                     self.parameters)
        # Define transitions

        self.add_controller(self.movingtopoint1,
                            (self.at_point1, self.movingtopoint2))
        self.add_controller(self.movingtopoint2,
                            (self.at_point2, self.movingtopoint1))
        # Start in the 'go-to-goal' state
        self.current = self.movingtopoint1
Exemplo n.º 2
0
    def __init__(self, robot_pose, robot_info):
        """Create controllers and the state transitions"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        # The maximal distance to an obstacle (inexact)
        self.distmax = robot_info.ir_sensors.rmax + robot_info.wheels.base_length / 2

        # 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 = self.distmax * 0.85

        self.process_state_info(robot_info)

        #Add controllers
        self.gtg = self.create_controller('GoToGoal', self.parameters)
        self.avoidobstacles = self.create_controller('AvoidObstacles',
                                                     self.parameters)
        self.wall = self.create_controller('FollowWall', self.parameters)
        self.hold = self.create_controller('Hold', None)

        # 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_wall, self.wall))
        self.add_controller(self.wall, (self.at_goal, self.hold),
                            (self.unsafe, self.avoidobstacles),
                            (self.wall_cleared, self.gtg))
        self.add_controller(self.avoidobstacles, (self.at_goal, self.hold),
                            (self.safe, self.wall))

        # Start in the 'go-to-goal' state
        self.current = self.gtg
Exemplo n.º 3
0
    def __init__(self, robot_pose, robot_info):
        """Create controllers and the state transitions"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        # Fill in poses for the controller
        self.parameters.sensor_poses = robot_info.ir_sensors.poses[:]

        # Add controllers
        self.avoidobstacles = self.create_controller(
            'avoidobstacles.AvoidObstacles', self.parameters)
        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)
        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),
        )

        # Start in the 'go-to-goal' state
        self.current = self.gtg
    def __init__(self, robot_pose, robot_info):
        """Create controllers and the state transitions"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        # The maximal distance to an obstacle (inexact)
        self.distmax = robot_info.ir_sensors.rmax + robot_info.wheels.base_length/2

        # 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 = self.distmax*0.85
        self.parameters.path = [(1.0, 0.5), (0.5, 1.0)]
        self.process_state_info(robot_info)
        
        #Add controllers
        self.movingtopoint1 = self.create_controller('MovingToPoint1', self.parameters)
        self.movingtopoint2 = self.create_controller('MovingToPoint2', self.parameters)
        # Define transitions
       
        self.add_controller(self.movingtopoint1,
                             (self.at_point1, self.movingtopoint2))
        self.add_controller(self.movingtopoint2,
                             (self.at_point2, self.movingtopoint1))
        # Start in the 'go-to-goal' state
        self.current = self.movingtopoint1
Exemplo n.º 5
0
    def __init__(self, robot_pose, robot_info):
        K3Supervisor.__init__(self, robot_pose, robot_info)

        #Add at least one controller
        self.gtg = self.add_controller('gotogoal.GoToGoal', self.parameters.gains)

        #Set default controller
        self.current = self.gtg
Exemplo n.º 6
0
    def __init__(self, robot_pose, robot_info):
        K3Supervisor.__init__(self, robot_pose, robot_info)

        #Add at least one controller
        self.gtg = self.add_controller('gotogoal.GoToGoal',
                                       self.parameters.gains)

        #Set default controller
        self.current = self.gtg
Exemplo n.º 7
0
    def __init__(self, robot_pose, robot_info):
        """Creates an avoid-obstacle controller and go-to-goal controller"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        #Add controllers ( go to goal is default)
        self.parameters.sensor_poses = robot_info.ir_sensors.poses[:]
        self.avoidobstacles = self.get_controller('avoidobstacles.AvoidObstacles', self.parameters)
        self.gtg = self.get_controller('gotogoal.GoToGoal', self.parameters)

        self.current = self.gtg
        self.old_omega = 0
Exemplo n.º 8
0
    def __init__(self, robot_pose, robot_info):
        """Creates an avoid-obstacle controller and go-to-goal controller"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        #Add controllers ( go to goal is default)
        self.ui_params.sensor_angles = [pose.theta for pose in robot_info.ir_sensors.poses]
        self.avoidobstacles = self.add_controller('avoidobstacles.AvoidObstacles', self.ui_params)
        self.gtg = self.add_controller('gotogoal.GoToGoal', self.ui_params.gains)
        self.hold = self.add_controller('hold.Hold', None)

        self.current = self.gtg
Exemplo n.º 9
0
    def __init__(self, robot_pose, robot_info):
        """Creates an avoid-obstacle controller and go-to-goal controller"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        #Add controllers ( go to goal is default)
        self.parameters.sensor_poses = robot_info.ir_sensors.poses[:]
        self.avoidobstacles = self.get_controller(
            'avoidobstacles.AvoidObstacles', self.parameters)
        self.gtg = self.get_controller('gotogoal.GoToGoal', self.parameters)

        self.current = self.gtg
        self.old_omega = 0
Exemplo n.º 10
0
    def __init__(self, robot_pose, robot_info):
        """Create controllers and the state transitions"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        # Fill in poses for the controller
        self.parameters.sensor_poses = robot_info.ir_sensors.poses[:]

        # Add controllers
        self.blending = self.create_controller('blending.Blending', self.parameters)
        self.hold = self.create_controller('hold.Hold', None)
        
        # Transitions if at goal
        self.add_controller(self.hold,
                            (lambda: not self.at_goal(), self.blending))
        self.add_controller(self.blending,
                            (self.at_goal,self.hold))

        # Start in the 'blending' state
        self.current = self.blending
Exemplo n.º 11
0
    def __init__(self, robot_pose, robot_info):
        """Create controllers and the state transitions"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        # Fill in poses for the controller
        self.parameters.sensor_poses = robot_info.ir_sensors.poses[:]

        # Add controllers
        self.blending = self.create_controller('blending.Blending',
                                               self.parameters)
        self.hold = self.create_controller('hold.Hold', None)

        # Transitions if at goal
        self.add_controller(self.hold,
                            (lambda: not self.at_goal(), self.blending))
        self.add_controller(self.blending, (self.at_goal, self.hold))

        # Start in the 'blending' state
        self.current = self.blending
Exemplo n.º 12
0
    def __init__(self, robot_pose, robot_info):
        """Creates an avoid-obstacle controller and go-to-goal controller"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        #Add controllers ( go to goal is default)
        self.parameters.sensor_poses = robot_info.ir_sensors.poses[:]
        self.avoidobstacles = self.get_controller('avoidobstacles.AvoidObstacles', self.parameters)
        self.gtg = self.get_controller('gotogoal.GoToGoal', self.parameters)
        self.hold = self.get_controller('hold.Hold', None)

        self.add_controller(self.hold)
        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),
                            )

        self.current = self.gtg
Exemplo n.º 13
0
    def __init__(self, robot_pose, robot_info):
        """Creates an avoid-obstacle controller and go-to-goal controller"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        #Add controllers ( go to goal is default)
        self.parameters.sensor_poses = robot_info.ir_sensors.poses[:]
        self.avoidobstacles = self.get_controller(
            'avoidobstacles.AvoidObstacles', self.parameters)
        self.gtg = self.get_controller('gotogoal.GoToGoal', self.parameters)
        self.hold = self.get_controller('hold.Hold', None)

        self.add_controller(self.hold)
        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),
        )

        self.current = self.gtg
Exemplo n.º 14
0
    def __init__(self, robot_pose, robot_info):
        """Create controllers and the state transitions"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        # The maximal distance to an obstacle (inexact)
        self.distmax = robot_info.ir_sensors.rmax + robot_info.wheels.base_length/2

        # 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 = self.distmax*0.85
        
        self.process_state_info(robot_info)
        
        #Add controllers
        self.gtg = self.create_controller('GoToGoal', self.parameters)
        self.avoidobstacles = self.create_controller('AvoidObstacles', self.parameters)
        self.wall = self.create_controller('FollowWall', self.parameters)
        self.hold = self.create_controller('Hold', None)
        
        # 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_wall, self.wall))
        self.add_controller(self.wall,
                            (self.at_goal,self.hold),
                            (self.unsafe, self.avoidobstacles),
                            (self.wall_cleared, self.gtg))
        self.add_controller(self.avoidobstacles,
                            (self.at_goal, self.hold),
                            (self.safe, self.wall))

        # Start in the 'go-to-goal' state
        self.current = self.gtg
Exemplo n.º 15
0
    def __init__(self, robot_pose, robot_info):
        """Create controllers and the state transitions"""
        K3Supervisor.__init__(self, robot_pose, robot_info)

        # Fill in poses for the controller
        self.parameters.sensor_poses = robot_info.ir_sensors.poses[:]

        # Add controllers
        self.avoidobstacles = self.create_controller('avoidobstacles.AvoidObstacles', self.parameters)
        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)
        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),
                            )

        # Start in the 'go-to-goal' state
        self.current = self.gtg
Exemplo n.º 16
0
    def __init__(self, robot_pose, robot_info, options=None):
        """Create controllers and the state transitions"""
        K3Supervisor.__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

        # The maximal distance to an obstacle (inexact)
        self.distmax = robot_info.ir_sensors.rmax + robot_info.wheels.base_length / 2

        # 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 = self.distmax * 0.85
        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

        self.process_state_info(robot_info)

        #Add controllers
        self.gtg = self.create_controller('GoToGoal', self.parameters)
        self.avoidobstacles = self.create_controller('K3_AvoidObstacles',
                                                     self.parameters)
        self.wall = self.create_controller('FollowWall', self.parameters)
        self.hold = self.create_controller('Hold', None)
        self.path = self.create_controller('FollowPath', 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_wall, self.wall))
        self.add_controller(self.wall, (self.at_goal, self.hold),
                            (self.unsafe, self.avoidobstacles),
                            (self.wall_cleared, self.gtg))
        # self.add_controller(self.avoidobstacles,
        #                     (self.at_goal, self.hold),
        #                     (self.safe, self.wall))
        self.add_controller(self.hold, (lambda: not self.at_goal(), self.gtg))

        self.add_controller(self.avoidobstacles, (self.at_goal, self.hold),
                            (self.free, self.path))

        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
Exemplo n.º 17
0
    def __init__(self, robot_pose, robot_info, options=None):
        """Create controllers and the state transitions"""
        K3Supervisor.__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

        # The maximal distance to an obstacle (inexact)
        self.distmax = robot_info.ir_sensors.rmax + robot_info.wheels.base_length / 2

        # 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 = self.distmax * 0.85
        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

        self.process_state_info(robot_info)

        # Add controllers
        self.gtg = self.create_controller("GoToGoal", self.parameters)
        self.avoidobstacles = self.create_controller("K3_AvoidObstacles", self.parameters)
        self.wall = self.create_controller("FollowWall", self.parameters)
        self.hold = self.create_controller("Hold", None)
        self.path = self.create_controller("FollowPath", 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_wall, self.wall))
        self.add_controller(
            self.wall, (self.at_goal, self.hold), (self.unsafe, self.avoidobstacles), (self.wall_cleared, self.gtg)
        )
        # self.add_controller(self.avoidobstacles,
        #                     (self.at_goal, self.hold),
        #                     (self.safe, self.wall))
        self.add_controller(self.hold, (lambda: not self.at_goal(), self.gtg))

        self.add_controller(self.avoidobstacles, (self.at_goal, self.hold), (self.free, self.path))

        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