bindings/python/pinocchio/explog.py
Go to the documentation of this file.
1 #
2 # Copyright (c) 2015-2018 CNRS INRIA
3 # Copyright (c) 2015 Wandercraft, 86 rue de Paris 91400 Orsay, France.
4 #
5 
6 import math
7 
8 import numpy as np
9 
10 from . import pinocchio_pywrap as pin
11 
12 def exp(x):
13  if isinstance(x, pin.Motion):
14  return pin.exp6(x)
15  if np.isscalar(x):
16  return math.exp(x)
17  if isinstance(x, np.ndarray):
18  if x.shape == (6, 1) or x.shape == (6,):
19  return pin.exp6(pin.Motion(x))
20  if x.shape == (3, 1) or x.shape == (3,):
21  return pin.exp3(x)
22  raise ValueError('Error only 3 and 6 vectors are allowed.')
23  raise ValueError('Error exp is only defined for real, vector3, vector6 and pin.Motion objects.')
24 
25 
26 def log(x):
27  if isinstance(x, pin.SE3):
28  return pin.log6(x)
29  if np.isscalar(x):
30  return math.log(x)
31  if isinstance(x, np.ndarray):
32  if x.shape == (4, 4):
33  return pin.log6(x)
34  if x.shape == (3, 3):
35  return pin.log3(x)
36  raise ValueError('Error only 3 and 4 matrices are allowed.')
37  raise ValueError('Error log is only defined for real, matrix3, matrix4 and pin.SE3 objects.')
38 
39 __all__ = ['exp', 'log']


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:02