Esempio n. 1
0
def main():
    print("Loading smoothie connector")
    smoothie = connectors.SmoothieV11TelnetConnector(config.SMOOTHIE_HOST)

    print("Turning wheels right")
    smoothie.write("G0 A-38 F1000")
    res = smoothie.read_some()

    if res != adapters.SmoothieAdapter.RESPONSE_OK:
        print("Couldn't turn wheels right, smoothie error occurred:", res)
        exit(1)

    print("Execution done")
Esempio n. 2
0
def main():
    print("Loading smoothie connector")
    smoothie = connectors.SmoothieV11TelnetConnector(config.SMOOTHIE_HOST)

    print("Moving forward")
    smoothie.write("G0 B48.9 F1000")
    res = smoothie.read_some()

    if res != adapters.SmoothieAdapter.RESPONSE_OK:
        print("Couldn't move forward, smoothie error occurred:", res)
        exit(1)

    print("Execution done")
Esempio n. 3
0
def main():
    print("Loading smoothie connector")
    smoothie = connectors.SmoothieV11TelnetConnector(config.SMOOTHIE_HOST)

    print("Calibrating Z")
    smoothie.write("G28 Z1000")
    print(smoothie.read_some())

    print("Extracting")
    smoothie.write("G0 Z-30 F1000")
    print(smoothie.read_some())

    print("Picking cork up")
    smoothie.write("G28 Z1000")
    print(smoothie.read_some())

    print("Done!")
Esempio n. 4
0
    def __init__(self, smoothie_host):
        if type(smoothie_host) is not str:
            raise TypeError(
                "invalid smoothie_host type: should be str, received " +
                type(smoothie_host).__name__)

        if config.SMOOTHIE_BACKEND == 1:
            self._smc = connectors.SmoothieV11TelnetConnector(smoothie_host)
        elif config.SMOOTHIE_BACKEND == 2:
            self._smc = connectors.SmoothieV11SerialConnector(
                smoothie_host, config.SMOOTHIE_BAUDRATE)
        else:
            raise ValueError("wrong config.SMOOTHIE_BACKEND value: " +
                             str(smoothie_host))

        self._sync_locker = multiprocessing.RLock()
        self._x_cur = multiprocessing.Value("d", 0)
        self._y_cur = multiprocessing.Value("d", 0)
        self._z_cur = multiprocessing.Value("d", 0)
        self._a_cur = multiprocessing.Value("d", 0)
        self._b_cur = multiprocessing.Value("d", 0)
        self._c_cur = multiprocessing.Value("d", 0)

        res = self.switch_to_relative()
        if res == self.RESPONSE_WTF or "ignored" in res:
            res = self.switch_to_relative()
        if res != self.RESPONSE_OK:
            # TODO: what if so?
            print(
                "Switching smoothie to relative was failed! Smoothie's response:\n",
                res)

        # TODO: temporary crutch - vesc is moving Z upward before smoothie loads, so we need to lower the cork a bit down
        res = self.custom_move_for(config.Z_F_EXTRACTION_DOWN, Z=5)
        self.wait_for_all_actions_done()
        if res != self.RESPONSE_OK:
            print(
                "Couldn't move cork down for Z-5! Calibration errors on Z axis are possible!"
            )

        res = self.ext_calibrate_cork()
        """