{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Motor axis controller\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from itom import ui\nfrom itom import actuator\nfrom itom import version as itomVersion\n\ngui = ui(\"demoMotorAxisController.ui\", ui.TYPEWINDOW)\n# please notice, that some signals/slots are already connected via Designer!\n\nc = gui.controller\nmotor = actuator(\"DummyMotor\", 4)\nc[\"actuator\"] = motor\nc[\"numAxis\"] = 4 # the first 4 axes from the motor are considered in this case.\nc[\n \"defaultAxisUnit\"\n] = \"UnitMum\" # available: UnitNm (0), UnitMum (1), UnitMm (2), UnitCm (3), UnitM (4) or UnitDeg (5)\nc[\n \"defaultAxisType\"\n] = \"TypeLinear\" # available: TypeRotational (0), TypeLinear (1)\nc[\"defaultRelativeStepSize\"] = 0.010 # always in mm or deg\nc[\"axisNames\"] = (\"x\", \"y\", \"z\", \"alpha\")\nc[\"defaultDecimals\"] = 2\n\nqtVersion = itomVersion(1)[\"itom\"][\"QT_Version\"]\n\n# the fourth axis is a rotational axis:\nif qtVersion >= \"5.5.0\":\n c.call(\"setAxisType\", 3, \"TypeRotational\")\n c.call(\"setAxisUnit\", 3, \"UnitDeg\")\nelse:\n # before Qt 5.5.0, slots with enumeration data types can only be called with their integer value\n c.call(\"setAxisType\", 3, 0) # TypeRotational\n c.call(\"setAxisUnit\", 3, 5) # UnitDeg\n\ngui.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 0 }