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_default as pin
11 
12 
13 def exp(x):
14  if isinstance(x, pin.Motion):
15  return pin.exp6(x)
16  if np.isscalar(x):
17  return math.exp(x)
18  if isinstance(x, np.ndarray):
19  if x.shape == (6, 1) or x.shape == (6,):
20  return pin.exp6(pin.Motion(x))
21  if x.shape == (3, 1) or x.shape == (3,):
22  return pin.exp3(x)
23  raise ValueError("Error only 3 and 6 vectors are allowed.")
24  raise ValueError(
25  "Error exp is only defined for real, vector3, vector6 and pin.Motion objects."
26  )
27 
28 
29 def log(x):
30  if isinstance(x, pin.SE3):
31  return pin.log6(x)
32  if np.isscalar(x):
33  return math.log(x)
34  if isinstance(x, np.ndarray):
35  if x.shape == (4, 4):
36  return pin.log6(x)
37  if x.shape == (3, 3):
38  return pin.log3(x)
39  raise ValueError("Error only 3 and 4 matrices are allowed.")
40  raise ValueError(
41  "Error log is only defined for real, matrix3, matrix4 and pin.SE3 objects."
42  )
43 
44 
45 __all__ = ["exp", "log"]
pinocchio.explog.exp
def exp(x)
Definition: bindings/python/pinocchio/explog.py:13
pinocchio.explog.log
def log(x)
Definition: bindings/python/pinocchio/explog.py:29


pinocchio
Author(s):
autogenerated on Sat Jun 22 2024 02:41:46