Skip to content

Allow set_velocities to accept ids as scalar or 0d array#41

Open
pooleya19 wants to merge 1 commit into
robotarium:masterfrom
pooleya19:fix-scalar-ids
Open

Allow set_velocities to accept ids as scalar or 0d array#41
pooleya19 wants to merge 1 commit into
robotarium:masterfrom
pooleya19:fix-scalar-ids

Conversation

@pooleya19

Copy link
Copy Markdown

Fixes #39.

Calling set_velocities(ids, velocities) when ids is a scalar or a 0-dimensional NDArray raises a ValueError. This is caused by numpy failing to broadcast velocities with shape (2,1) to self._velocities[:,ids] with shape (2,).

Making ids be at least 1d allows self._velocities[:,ids] to maintain a shape of (2,1), and should have no effect to function calls when ids is 1d or 2d.

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 this pull request may close these issues.

set_velocities raises ValueError when ids is a scalar or 0d array

1 participant