2024-02-21 11:27:08 +08:00
|
|
|
{
|
|
|
|
"cells": [
|
2024-05-05 08:09:01 +08:00
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"# Test in Simulation"
|
|
|
|
]
|
|
|
|
},
|
2024-02-21 11:27:08 +08:00
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-03-18 11:36:53 +08:00
|
|
|
"execution_count": null,
|
2024-02-21 11:27:08 +08:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"from Go2Py.sim.mujoco import Go2Sim\n",
|
2024-05-05 08:09:01 +08:00
|
|
|
"from Go2Py.robot.fsm import FSM\n",
|
|
|
|
"from Go2Py.robot.remote import KeyboardRemote\n",
|
|
|
|
"from Go2Py.robot.safety import SafetyHypervisor"
|
2024-02-21 11:27:08 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-03-18 11:36:53 +08:00
|
|
|
"execution_count": null,
|
2024-02-21 11:27:08 +08:00
|
|
|
"metadata": {},
|
2024-03-16 10:43:58 +08:00
|
|
|
"outputs": [],
|
2024-02-21 11:27:08 +08:00
|
|
|
"source": [
|
2024-03-16 10:39:10 +08:00
|
|
|
"robot = Go2Sim()\n",
|
2024-05-05 08:09:01 +08:00
|
|
|
"remote = KeyboardRemote()\n",
|
|
|
|
"safety_hypervisor = SafetyHypervisor(robot)"
|
2024-02-21 11:27:08 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-03-16 10:43:58 +08:00
|
|
|
"execution_count": null,
|
2024-03-16 10:39:10 +08:00
|
|
|
"metadata": {},
|
2024-03-16 10:43:58 +08:00
|
|
|
"outputs": [],
|
2024-03-16 10:39:10 +08:00
|
|
|
"source": [
|
2024-05-05 08:09:01 +08:00
|
|
|
"robot.sitDownReset()\n",
|
|
|
|
"fsm = FSM(robot, remote, safety_hypervisor)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"fsm.close()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"# Test on Real Robot"
|
2024-03-16 10:39:10 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
2024-03-16 12:27:06 +08:00
|
|
|
"source": [
|
2024-05-05 08:09:01 +08:00
|
|
|
"from Go2Py.robot.interface.dds import GO2Real\n",
|
|
|
|
"import time\n",
|
|
|
|
"from Go2Py.robot.fsm import FSM\n",
|
|
|
|
"from Go2Py.robot.remote import KeyboardRemote\n",
|
|
|
|
"from Go2Py.robot.safety import SafetyHypervisor"
|
2024-03-16 13:25:53 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2024-05-05 08:09:01 +08:00
|
|
|
"robot = GO2Real(mode='lowlevel')\n",
|
|
|
|
"remote = KeyboardRemote()\n",
|
|
|
|
"safety_hypervisor = SafetyHypervisor(robot)"
|
2024-03-16 12:27:06 +08:00
|
|
|
]
|
2024-03-16 13:25:53 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2024-05-05 08:09:01 +08:00
|
|
|
"fsm = FSM(robot, remote, safety)"
|
2024-03-16 13:25:53 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-03-18 11:36:53 +08:00
|
|
|
"execution_count": null,
|
2024-03-16 13:25:53 +08:00
|
|
|
"metadata": {},
|
2024-03-18 11:36:53 +08:00
|
|
|
"outputs": [],
|
2024-03-16 13:25:53 +08:00
|
|
|
"source": [
|
2024-05-05 08:09:01 +08:00
|
|
|
"fsm.close()"
|
2024-03-16 13:25:53 +08:00
|
|
|
]
|
2024-02-21 11:27:08 +08:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
|
|
|
"display_name": "b1-env",
|
|
|
|
"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-05-05 08:09:01 +08:00
|
|
|
"version": "3.8.18"
|
2024-02-21 11:27:08 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 2
|
|
|
|
}
|