Пример #1
0
 def _move_circular(self, delta, radius, velocity, direction):
     delta = delta.round_to_nearest_pulse()
     self.__check_delta(delta)
     # get delta vector and put it on circle
     if self._plane == PLANE_XY:
         self.__check_circle(delta.x, delta.y, radius.x, radius.y,
                             direction, self._position.x,
                             self._position.y, TABLE_SIZE_X_MM,
                             TABLE_SIZE_Y_MM, STEPPER_PULSES_PER_MM_X,
                             STEPPER_PULSES_PER_MM_Y)
     elif self._plane == PLANE_YZ:
         self.__check_circle(delta.y, delta.z, radius.y, radius.z,
                             direction, self._position.y,
                             self._position.z, TABLE_SIZE_Y_MM,
                             TABLE_SIZE_Z_MM, STEPPER_PULSES_PER_MM_Y,
                             STEPPER_PULSES_PER_MM_Z)
     elif self._plane == PLANE_ZX:
         self.__check_circle(delta.z, delta.x, radius.z, radius.x,
                             direction, self._position.z,
                             self._position.x, TABLE_SIZE_Z_MM,
                             TABLE_SIZE_X_MM, STEPPER_PULSES_PER_MM_Z,
                             STEPPER_PULSES_PER_MM_X)
     radius = radius.round_to_nearest_pulse()
     logging.info("Moving circularly {} {} {} with radius {}"
                  " and velocity {}".format(self._plane, delta,
                                            direction, radius, velocity))
     gen = PulseGeneratorCircular(delta, radius, self._plane,
                                  direction, velocity)
     self.__check_velocity(gen.max_velocity())
     # do movements
     extruder_speed = self._get_extruder_speed(delta, velocity)
     self._start_extruder_move(delta.e, extruder_speed)
     hal.move(gen)
     # save position
     self._position = self._position + delta
Пример #2
0
 def _move_circular(self, delta, radius, velocity, direction):
     delta = delta.round(1.0 / STEPPER_PULSES_PER_MM_X,
                         1.0 / STEPPER_PULSES_PER_MM_Y,
                         1.0 / STEPPER_PULSES_PER_MM_Z,
                         1.0 / STEPPER_PULSES_PER_MM_E,
                         1.0 / STEPPER_PULSES_PER_MM_P)
     radius = radius.round(1.0 / STEPPER_PULSES_PER_MM_X,
                           1.0 / STEPPER_PULSES_PER_MM_Y,
                           1.0 / STEPPER_PULSES_PER_MM_Z,
                           1.0 / STEPPER_PULSES_PER_MM_E,
                           1.0 / STEPPER_PULSES_PER_MM_P)
     self.__check_delta(delta)
     # get delta vector and put it on circle
     circle_end = Coordinates(0, 0, 0, 0, 0)
     if self._plane == PLANE_XY:
         circle_end.x, circle_end.y = \
             self.__adjust_circle(delta.x, delta.y, radius.x, radius.y,
                                  direction, self._position.x,
                                  self._position.y, TABLE_SIZE_X_MM,
                                  TABLE_SIZE_Y_MM)
         circle_end.z = delta.z
     elif self._plane == PLANE_YZ:
         circle_end.y, circle_end.z = \
             self.__adjust_circle(delta.y, delta.z, radius.y, radius.z,
                                  direction, self._position.y,
                                  self._position.z, TABLE_SIZE_Y_MM,
                                  TABLE_SIZE_Z_MM)
         circle_end.x = delta.x
     elif self._plane == PLANE_ZX:
         circle_end.z, circle_end.x = \
             self.__adjust_circle(delta.z, delta.x, radius.z, radius.x,
                                  direction, self._position.z,
                                  self._position.x, TABLE_SIZE_Z_MM,
                                  TABLE_SIZE_X_MM)
         circle_end.y = delta.y
     circle_end.e = delta.e
     circle_end = circle_end.round(1.0 / STEPPER_PULSES_PER_MM_X,
                                   1.0 / STEPPER_PULSES_PER_MM_Y,
                                   1.0 / STEPPER_PULSES_PER_MM_Z)
     logging.info("Moving circularly {} {} {} with radius {}"
                  " and velocity {}".format(self._plane, circle_end,
                                            direction, radius, velocity))
     gen = PulseGeneratorCircular(circle_end, radius, self._plane,
                                  direction, velocity)
     self.__check_velocity(gen.max_velocity())
     # if finish coords is not on circle, move some distance linearly
     linear_delta = delta - circle_end
     linear_gen = None
     if not linear_delta.is_zero():
         logging.info(
             "Moving additionally {} to finish circle command".format(
                 linear_delta))
         linear_gen = PulseGeneratorLinear(linear_delta, velocity)
         self.__check_velocity(linear_gen.max_velocity())
     # do movements
     hal.move(gen)
     if linear_gen is not None:
         hal.move(linear_gen)
     # save position
     self._position = self._position + circle_end + linear_delta
Пример #3
0
    def _move_linear(self, delta, velocity):
        delta = delta.round(1.0 / STEPPER_PULSES_PER_MM_X,
                            1.0 / STEPPER_PULSES_PER_MM_Y,
                            1.0 / STEPPER_PULSES_PER_MM_Z,
                            1.0 / STEPPER_PULSES_PER_MM_E)
        if delta.is_zero():
            return
        self.__check_delta(delta)

        logging.info("Moving linearly {}".format(delta))
        gen = PulseGeneratorLinear(delta, velocity)
        self.__check_velocity(gen.max_velocity())
        hal.move(gen)
        # save position
        self._position = self._position + delta
Пример #4
0
    def _move_linear(self, delta, velocity):
        delta = delta.round_to_nearest_pulse()
        if delta.is_zero():
            return
        self.__check_delta(delta)

        logging.info("Moving linearly {}".format(delta))
        gen = PulseGeneratorLinear(delta, velocity)
        self.__check_velocity(gen.max_velocity())

        extruder_speed = self._get_extruder_speed(delta, velocity)
        self._start_extruder_move(delta.e, extruder_speed)
        hal.move(gen)

        # save position
        self._position = self._position + delta