Example #1
0
    def __init__(self, factory):
        """Constructor.

        Args:
            factory (factory.FactoryCreate)
        """
        self.create = factory.create_create()
        self.time = factory.create_time_helper()
        self.servo = factory.create_servo()
        self.sonar = factory.create_sonar()
        self.p_controller = PController(k_p=500.0)
        self.pd_controller = PDController(k_p=500.0, k_d=50.0)
Example #2
0
    def __init__(self, filename):

        # check if we are running in screen. If not, terminate
        # this command will fail if the program is executed outside of screen
        try:
            subprocess.check_output(['pgrep', '-f', 'screen'])
        except subprocess.CalledProcessError:
            raise RuntimeError(
                "Program is not running in screen. Aborting. Please restart in screen."
            )

        # initialize P controller
        self.p_ctrl = PController(filename)
 def __init__(self, factory):
     self.create = factory.create_create()
     self.time = factory.create_time_helper()
     self.sonar = factory.create_sonar()
     self.servo = factory.create_servo()
     # define the gains here
     self.kp = 1000
     self.kd = 3
     self.minOutput = -200
     self.maxOutput = 200
     # instantiate your controllers here
     self.p_controller = PController(self.kp, self.minOutput,
                                     self.maxOutput)
     self.pd_controller = PDController(self.kp, self.kd, self.minOutput,
                                       self.maxOutput)