示例#1
0
    def reset_elevation(self):
        BrickPiOriginal.MotorEnable[PORT_B] = 1
        BrickPiUpdateValues()

        if (BrickPiOriginal.SensorType[PORT_2] != 1):
            BrickPiOriginal.MotorSpeed[PORT_B] = 30

        BrickPiUpdateValues()

        while (BrickPiOriginal.Sensor[PORT_2] != 1):
            BrickPiUpdateValues()
            time.sleep(0.05)

        BrickPiOriginal.MotorSpeed[PORT_B] = -30
        BrickPiUpdateValues()
示例#2
0
    def reset_azimuth(self):
        BrickPiOriginal.MotorEnable[PORT_A] = 1
        BrickPiUpdateValues()

        if (BrickPiOriginal.SensorType[PORT_1] != 1):
            BrickPiOriginal.MotorSpeed[PORT_A] = 30

        BrickPiUpdateValues()

        while (BrickPiOriginal.Sensor[PORT_1] != 1):
            BrickPiUpdateValues()
            time.sleep(0.05)

        BrickPiOriginal.MotorSpeed[PORT_A] = -30
        BrickPiUpdateValues()
示例#3
0
	def reset_elevation(self):
		BrickPiOriginal.MotorEnable[PORT_B] = 1
		BrickPiUpdateValues()

		if (BrickPiOriginal.SensorType[PORT_2] != 1):
			BrickPiOriginal.MotorSpeed[PORT_B] = 30

		BrickPiUpdateValues()

		while(BrickPiOriginal.Sensor[PORT_2] != 1):
			BrickPiUpdateValues()
			time.sleep(0.05)

		BrickPiOriginal.MotorSpeed[PORT_B] = -30
		BrickPiUpdateValues()
示例#4
0
	def reset_azimuth(self):
		BrickPiOriginal.MotorEnable[PORT_A] = 1
		BrickPiUpdateValues()

		if (BrickPiOriginal.SensorType[PORT_1] != 1):
			BrickPiOriginal.MotorSpeed[PORT_A] = 30

		BrickPiUpdateValues()

		while(BrickPiOriginal.Sensor[PORT_1] != 1):
			BrickPiUpdateValues()
			time.sleep(0.05)

		BrickPiOriginal.MotorSpeed[PORT_A] = -30
		BrickPiUpdateValues()
示例#5
0
	def set_elevation(self, value):
		self.elevation_in_progress = True
		self.logger.info('\nSetting elevation to ' + (str(value)))
		
		encoder_before = self.mypi.Encoder[PORT_B]
		self.logger.info('encoder_before' + str(encoder_before))

		if (value >= 90):
			value = 90

		if (value <= 0):
			value = 0

		self.logger.info('self.elevation: ' + str(self.elevation));
		self.logger.info('value_to_set: ' + str(value));

		rotate_value = None
		action = None
		if (self.elevation > value):
				rotate_value = (self.elevation - value)

				action = 'decrease'

				self.logger.info("Current position is higher than desired degree, decreasing it")
				self.logger.info("rotate_value: " + str(rotate_value))

				self.elevation_motor.rotate(self.elevation_power_down, -1 * rotate_value * self.elevation_coef)
				time.sleep(0.1)
				self.elevation_motor.update_position()

		elif (self.elevation < value):
				rotate_value = (value - self.elevation) 

				self.logger.info("Current position is lower than desired degree, increasing it")
				self.logger.info("rotate_value" + str(rotate_value))

				self.elevation_motor.rotate(self.elevation_power, rotate_value * self.elevation_coef)
				time.sleep(0.1)
				self.elevation_motor.update_position()

		time.sleep(0.1)
		encoder_after = self.mypi.Encoder[PORT_B]

		self.logger.info('encoder_after' + str(encoder_after))

		self.elevation = self.elevation + ((encoder_after - encoder_before)/float(self.elevation_coef))/2

		if (self.elevation < 0):
			self.logger.info('We went under 0, reseting it to 0')
			self.elevation = 0
		elif (self.elevation > 90):
			self.logger.info('We went over 90, reseting it to 90')
			self.elevation = 90

		self.logger.info('Wanted to move for ' + str(rotate_value))
		self.logger.info('Moved for ' + str(((encoder_after - encoder_before)/float(self.elevation_coef))/2))

		self.elevation_in_progress = False
示例#6
0
    def set_elevation(self, value):
        self.elevation_in_progress = True
        self.logger.info('\nSetting elevation to ' + (str(value)))

        encoder_before = self.mypi.Encoder[PORT_B]
        self.logger.info('encoder_before' + str(encoder_before))

        if (value >= 90):
            value = 90

        if (value <= 0):
            value = 0

        self.logger.info('self.elevation: ' + str(self.elevation))
        self.logger.info('value_to_set: ' + str(value))

        rotate_value = None
        action = None
        if (self.elevation > value):
            rotate_value = (self.elevation - value)

            action = 'decrease'

            self.logger.info(
                "Current position is higher than desired degree, decreasing it"
            )
            self.logger.info("rotate_value: " + str(rotate_value))

            self.elevation_motor.rotate(
                self.elevation_power_down,
                -1 * rotate_value * self.elevation_coef)
            time.sleep(0.1)
            self.elevation_motor.update_position()

        elif (self.elevation < value):
            rotate_value = (value - self.elevation)

            self.logger.info(
                "Current position is lower than desired degree, increasing it")
            self.logger.info("rotate_value" + str(rotate_value))

            self.elevation_motor.rotate(self.elevation_power,
                                        rotate_value * self.elevation_coef)
            time.sleep(0.1)
            self.elevation_motor.update_position()

        time.sleep(0.1)
        encoder_after = self.mypi.Encoder[PORT_B]

        self.logger.info('encoder_after' + str(encoder_after))

        self.elevation = self.elevation + (
            (encoder_after - encoder_before) / float(self.elevation_coef)) / 2

        if (self.elevation < 0):
            self.logger.info('We went under 0, reseting it to 0')
            self.elevation = 0
        elif (self.elevation > 90):
            self.logger.info('We went over 90, reseting it to 90')
            self.elevation = 90

        self.logger.info('Wanted to move for ' + str(rotate_value))
        self.logger.info('Moved for ' + str((
            (encoder_after - encoder_before) / float(self.elevation_coef)) /
                                            2))

        self.elevation_in_progress = False