Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using signed_angle with vector array #107

Closed
Georacer opened this issue Feb 27, 2020 · 2 comments · Fixed by #110
Closed

Error using signed_angle with vector array #107

Georacer opened this issue Feb 27, 2020 · 2 comments · Fixed by #110

Comments

@Georacer
Copy link

Georacer commented Feb 27, 2020

Hello!

I am calling

angles = vg.signed_angle(vec1_array.T, points.T, look, units='rad')

with shapes

('points', (3, 8))
('vec1_array', (3, 8))
('look', (3, 1))

However, I get the error:

Traceback (most recent call last):
  File "./extract_fe_pictures.py", line 113, in <module>
    test_code('skywalker_2013_mod', plot=False, interactive=False, export_path='.', verbose=False)
  File "./extract_fe_pictures.py", line 28, in test_code
    safe_poly.plot()
  File "/home/george/ros_workspaces/uav_ftc/src/uav_ftc/src/uav_ftc/polytope_utils.py", line 1271, in plot
    face_points = self._get_face_points(temp_polytope)
  File "/home/george/ros_workspaces/uav_ftc/src/uav_ftc/src/uav_ftc/polytope_utils.py", line 853, in _get_face_points
    angles = vg.signed_angle(vec1_array.T, points.T, look, units='rad')
  File "/usr/local/lib/python2.7/dist-packages/vg/core.py", line 297, in signed_angle
    return sign * angle(v1, v2, look, units=units)
  File "/usr/local/lib/python2.7/dist-packages/vg/core.py", line 251, in angle
    v1, v2 = [reject(v, from_v=look) for v in (v1, v2)]
  File "/usr/local/lib/python2.7/dist-packages/vg/core.py", line 125, in reject
    return vector - project(vector, onto=from_v)
  File "/usr/local/lib/python2.7/dist-packages/vg/core.py", line 92, in project
    return scalar_projection(vector, onto=onto)[:, np.newaxis] * normalize(onto)
  File "/usr/local/lib/python2.7/dist-packages/vg/core.py", line 112, in scalar_projection
    check(locals(), "onto", (k, 3))
  File "/usr/local/lib/python2.7/dist-packages/vg/shape.py", line 93, in check
    return check_value(locals_namespace[name], shape, name=name)
  File "/usr/local/lib/python2.7/dist-packages/vg/shape.py", line 54, in check_value
    raise ValueError("{} with shape {}; got {}".format(preamble, shape, a.shape))
ValueError: onto must be an array with shape (8, 3); got (3, 1)

I believe I have set the dimensions correctly.
Am I missing something?

Thanks!

@Georacer
Copy link
Author

Turns out look must be of dimension (N,) not (N,1) as mentioned in the function description.
Please close issue at will.

@paulmelnikow
Copy link
Member

Ah, that should be fixed in the docs! Thanks for the report!

@paulmelnikow paulmelnikow changed the title Error using singled_angle with vector array Error using signed_angle with vector array Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants