2024-03-11 06:34:53 +08:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 1,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"from Go2Py.robot.interface.dds import GO2Real\n",
|
|
|
|
"import time\n",
|
|
|
|
"robot = GO2Real(mode='lowlevel')"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 2,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"import numpy as np\n",
|
|
|
|
"import time\n",
|
|
|
|
"for i in range(1000):\n",
|
|
|
|
" q = np.zeros(12) \n",
|
|
|
|
" dq = np.zeros(12)\n",
|
|
|
|
" kp = np.zeros(12)\n",
|
|
|
|
" kd = np.zeros(12)\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": "code",
|
2024-03-14 12:42:02 +08:00
|
|
|
"execution_count": 4,
|
2024-03-11 06:34:53 +08:00
|
|
|
"metadata": {},
|
2024-03-14 12:42:02 +08:00
|
|
|
"outputs": [],
|
2024-03-11 06:34:53 +08:00
|
|
|
"source": [
|
2024-03-14 12:42:02 +08:00
|
|
|
"import time\n",
|
|
|
|
"dataset = []\n",
|
|
|
|
"for i in range(10000):\n",
|
|
|
|
" sample = robot.getJointStates()\n",
|
|
|
|
" dataset.append(sample['q'])\n",
|
|
|
|
" time.sleep(0.01)"
|
2024-03-11 06:34:53 +08:00
|
|
|
]
|
|
|
|
},
|
2024-03-14 12:42:02 +08:00
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-03-20 10:30:39 +08:00
|
|
|
"execution_count": 2,
|
2024-03-14 12:42:02 +08:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
2024-03-20 10:30:39 +08:00
|
|
|
"source": [
|
|
|
|
"from scipy.spatial.transform import Rotation"
|
|
|
|
]
|
2024-03-14 12:42:02 +08:00
|
|
|
},
|
2024-03-11 06:34:53 +08:00
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
2024-03-20 10:30:39 +08:00
|
|
|
"source": [
|
|
|
|
"Rotation.from_matrix(np.eye(3)).as_quat()"
|
|
|
|
]
|
2024-03-11 06:34:53 +08:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"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",
|
2024-03-20 10:30:39 +08:00
|
|
|
"version": "3.8.18"
|
2024-03-11 06:34:53 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 4
|
|
|
|
}
|