HiroIshida / yamaopt

robotic optimal sensor placement
MIT License
0 stars 1 forks source link

Avoid nan in polygon_to_matrix #43

Closed 708yamaguchi closed 2 years ago

708yamaguchi commented 2 years ago

When y=0 polygon is input,

import numpy as np
from yamaopt.polygon_constraint import polygon_to_matrix

a = np.array([[ 0.12625,    -0.1425,      1.01043141],
[ 0.12625,    -0.1425,      1.09043145],
[-0.05375,    -0.1425,      1.09043145],
[-0.05375,    -0.1425,      1.01043141]])
b = np.array([-0., -1., -0.])

polygon_to_matrix(a, b)

I got the following result.

/home/leus/ws_ws/src/708yamaguchi/yamaopt_ros/yamaopt/yamaopt/polygon_constraint.py:66: RuntimeWarning: invalid value encountered in divide
  normalize = lambda vec: vec/np.linalg.norm(vec)
Out[1]: 
(array([[-0., nan, nan],
        [-1., nan, nan],
        [-0., nan, nan]]), True)

I do not have confident in this solution...