Verified Commit 87de6d23 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

examples/python: all the examples are now using np.array

parent a8ca900e
......@@ -8,7 +8,6 @@ import numpy as np
import scipy.optimize as optimize
import hppfcl
hppfcl.switchToNumpyArray()
"""
Capsule definition
......
from __future__ import print_function
import pinocchio as pin, hppfcl
pin.switchToNumpyMatrix()
import os
from os.path import dirname, join, abspath
......
......@@ -8,8 +8,6 @@ except ImportError:
sys.exit(0)
from pinocchio.visualize import GepettoVisualizer
pin.switchToNumpyArray()
model = pin.Model()
geom_model = pin.GeometryModel()
......
import pinocchio as pin
pin.switchToNumpyMatrix()
import numpy as np
##
......@@ -16,8 +15,8 @@ data = model.createData()
# Set bounds (by default they are undefinded for a the Simple Humanoid model)
model.lowerPositionLimit = -np.matrix(np.ones((model.nq,1)))
model.upperPositionLimit = np.matrix(np.ones((model.nq,1)))
model.lowerPositionLimit = -np.ones((model.nq,1))
model.upperPositionLimit = np.ones((model.nq,1))
q = pin.randomConfiguration(model) # joint configuration
v = np.matrix(np.random.rand(model.nv,1)) # joint velocity
......
import pinocchio
pinocchio.switchToNumpyMatrix()
from sys import argv
from os.path import dirname, join, abspath
......@@ -44,4 +43,4 @@ for k, oMg in enumerate(collision_data.oMg):
print("\nVisual object placements:")
for k, oMg in enumerate(visual_data.oMg):
print(("{:d} : {: .2f} {: .2f} {: .2f}"
.format( k, *oMg.translation.T.flat )))
\ No newline at end of file
.format( k, *oMg.translation.T.flat )))
......@@ -2,7 +2,6 @@
# usage: launch gepetto-gui and then run this test
import pinocchio as pin
pin.switchToNumpyMatrix()
import numpy as np
import sys
import os
......
import pinocchio as pin
pin.switchToNumpyMatrix()
import numpy as np
##
......@@ -16,12 +15,12 @@ data = model.createData()
# Set bounds (by default they are undefinded for a the Simple Humanoid model)
model.lowerPositionLimit = -np.matrix(np.ones((model.nq,1)))
model.upperPositionLimit = np.matrix(np.ones((model.nq,1)))
model.lowerPositionLimit = -np.ones((model.nq,1))
model.upperPositionLimit = np.ones((model.nq,1))
q = pin.randomConfiguration(model) # joint configuration
v = np.matrix(np.random.rand(model.nv,1)) # joint velocity
a = np.matrix(np.random.rand(model.nv,1)) # joint acceleration
v = np.random.rand(model.nv,1) # joint velocity
a = np.random.rand(model.nv,1) # joint acceleration
# Evaluate the derivatives
......
......@@ -4,13 +4,12 @@ import numpy as np
from numpy.linalg import norm, solve
import pinocchio
pinocchio.switchToNumpyMatrix()
model = pinocchio.buildSampleModelManipulator()
data = model.createData()
JOINT_ID = 6
oMdes = pinocchio.SE3(pinocchio.utils.eye(3), np.matrix([1., 0., 1.]).T)
oMdes = pinocchio.SE3(np.eye(3), np.array([1., 0., 1.]))
q = pinocchio.neutral(model)
eps = 1e-4
......
import pinocchio as pin
pin.switchToNumpyMatrix()
import numpy as np
# Create model and data
......@@ -9,12 +8,12 @@ data = model.createData()
# Set bounds (by default they are undefinded)
model.lowerPositionLimit = -np.matrix(np.ones((model.nq,1)))
model.upperPositionLimit = np.matrix(np.ones((model.nq,1)))
model.lowerPositionLimit = -np.ones((model.nq,1))
model.upperPositionLimit = np.ones((model.nq,1))
q = pin.randomConfiguration(model) # joint configuration
v = np.matrix(np.random.rand(model.nv,1)) # joint velocity
a = np.matrix(np.random.rand(model.nv,1)) # joint acceleration
v = np.random.rand(model.nv,1) # joint velocity
a = np.random.rand(model.nv,1) # joint acceleration
# Evaluate all the terms required by the kinematics derivatives
......
......@@ -3,7 +3,6 @@
# pip install --user meshcat
import pinocchio as pin
pin.switchToNumpyMatrix()
import numpy as np
import sys
import os
......@@ -49,7 +48,7 @@ except ImportError as err:
viz.loadViewerModel(color = [0.0, 0.0, 0.0, 1.0])
# Display a robot configuration.
q0 = np.matrix([
q0 = np.array([
0, 0, 0.840252, 0, 0, 0, 1, # Free flyer
0, 0, -0.3490658, 0.6981317, -0.3490658, 0, # left leg
0, 0, -0.3490658, 0.6981317, -0.3490658, 0, # right leg
......
......@@ -3,7 +3,6 @@
# pip install --user meshcat
import pinocchio as pin
pin.switchToNumpyMatrix()
import numpy as np
import sys
import os
......
......@@ -4,7 +4,6 @@
#
import pinocchio as pin
pin.switchToNumpyMatrix()
from pinocchio.robot_wrapper import RobotWrapper
from pinocchio.visualize import (GepettoVisualizer, MeshcatVisualizer)
from sys import argv
......
import pinocchio as pin
pin.switchToNumpyMatrix()
from pinocchio.visualize import MeshcatVisualizer, GepettoVisualizer
from sys import argv
from numpy import pi
......
Markdown is supported
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