Commit 7b5769d3 authored by Thomas Flayols's avatar Thomas Flayols
Browse files

update tp4 notebook (actuators), upload tp5 (solo12 control)

parent ebea72b1
This diff is collapsed.
%% Cell type:markdown id: tags:
# Controllers for Solo12
This notebook will be used as a base to design controller to be executed on the Solo12 real quadruped robot.
%% Cell type:code id: tags:
``` python
from math import pi
from ipywidgets import interact
from pinocchio.visualize import MeshcatVisualizer
%config Completer.use_jedi = False
import numpy as np
np.set_printoptions(precision=3,suppress=True)
from example_robot_data.robots_loader import Solo12Loader
import pinocchio as pin
Solo12Loader.free_flyer = False #Important, we are working with a fixed based model version (12dof)
```
%% Cell type:markdown id: tags:
Let's load solo12 and setup a viewer
%% Cell type:code id: tags:
``` python
solo12 = Solo12Loader().robot
viz = MeshcatVisualizer(solo12.model, solo12.collision_model, solo12.visual_model)
viz.initViewer(loadModel=True)
viz.viewer.jupyter_cell()
q0 = solo12.q0
viz.display(q0)
```
%% Output
You can open the visualizer by visiting the following URL:
http://127.0.0.1:7000/static/
%% Cell type:markdown id: tags:
Let us have some input control to vary the robot state (Front left foot - 3dof)
%% Cell type:code id: tags:
``` python
@interact(HAA=(-1.0, 1.0, 0.01),HFE=(-1.0, 1.0, 0.01),KFE=(-1.0, 1.0, 0.01))
def change_q(HAA=0.,HFE=0.,KFE=0.):
q0[0:3] = HAA,HFE,KFE
print(q0[0:3])
viz.display(q0)
```
%% Output
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:markdown id: tags:
# Pinocchio cheat code
%% Cell type:markdown id: tags:
Get the Jacobian of the Feet, expressed locally, aligned with the world:
%% Cell type:code id: tags:
``` python
solo12.forwardKinematics(q0)
solo12.framesForwardKinematics(q0)
solo12.computeJointJacobians(q0)
J = solo12.getFrameJacobian(solo12.model.getFrameId('FL_FOOT'),pin.LOCAL_WORLD_ALIGNED)[:3]
print (J)
```
%% Output
[[ 0. -0.32 -0.16 0. 0. 0. 0. 0. 0. 0.
0. 0. ]
[ 0.32 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. ]
[ 0.059 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. ]]
%% Cell type:code id: tags:
``` python
```
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment