{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Simulated" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from Go2Py.sim.mujoco import Go2Sim\n", "from Go2Py.robot.model import Go2Model\n", "from Go2Py.estimation.contact import HysteresisContactDetector\n", "import pinocchio as pin \n", "import numpy as np\n", "import time" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "model = Go2Model()\n", "robot = Go2Sim()" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "dict_keys(['M', 'Minv', 'nle', 'g', 'J_w', 'J_b'])\n" ] } ], "source": [ "# Get robot robot states\n", "state = robot.getJointStates()\n", "\n", "# The pose and velocity generally is fed from an external state estimator,\n", "# here we just set it to identity\n", "T = np.eye(4)\n", "vel = np.zeros(6)\n", "\n", "# Compute the dynamics\n", "model.updateAllPose(state['q'], state['dq'], T, vel)\n", "\n", "# Get dynamic and kinematic models\n", "info = model.getInfo()\n", "print(info.keys())" ] } ], "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": 2 }