{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Lowlevel Control" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from Go2Py.robot.interface.dds import GO2Real\n", "import time\n", "robot = GO2Real(mode='lowlevel')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "robot.getJointStates()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import time\n", "for i in range(1000000):\n", " q = np.zeros(12) \n", " dq = np.zeros(12)\n", " kp = np.ones(12)*0.0\n", " kd = np.ones(12)*0.0\n", " tau = np.zeros(12)\n", " tau[0] = 0.0\n", " robot.setCommands(q, dq, kp, kd, tau)\n", " time.sleep(0.01) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Highlevel Control" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "pygame 2.5.2 (SDL 2.28.2, Python 3.8.18)\n", "Hello from the pygame community. https://www.pygame.org/contribute.html\n" ] } ], "source": [ "from Go2Py.robot.interface.dds import GO2Real\n", "import time\n", "robot = GO2Real(mode='highlevel')" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import time\n", "for i in range(200):\n", " robot.setCommandsHigh(0,0,0.2)\n", " time.sleep(0.01) " ] } ], "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.18" } }, "nbformat": 4, "nbformat_minor": 4 }