Skip to content
This repository has been archived by the owner on Aug 3, 2020. It is now read-only.

Grid layout with 0 free joints causes crash #176

Closed
VictorLamoine opened this issue Jan 11, 2017 · 3 comments
Closed

Grid layout with 0 free joints causes crash #176

VictorLamoine opened this issue Jan 11, 2017 · 3 comments
Labels

Comments

@VictorLamoine
Copy link

VictorLamoine commented Jan 11, 2017

If you load a robot model with 0 free joints the joint state publisher crashes:

Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/joint_state_publisher/joint_state_publisher", line 413, in <module>
    jsp = JointStatePublisher()
  File "/opt/ros/kinetic/lib/joint_state_publisher/joint_state_publisher", line 127, in __init__
    self.gui = JointStatePublisherGui("Joint State Publisher", self, num_rows)
  File "/opt/ros/kinetic/lib/joint_state_publisher/joint_state_publisher", line 304, in __init__
    self.positions = self.generate_grid_positions(len(sliders), self.num_rows)
  File "/opt/ros/kinetic/lib/joint_state_publisher/joint_state_publisher", line 383, in generate_grid_positions
    positions = [(y, x) for x in range(int((math.ceil(float(num_items) / num_rows)))) for y in range(num_rows)]
ZeroDivisionError: float division by zero

#150

Divison by zero here:

positions = [(y, x) for x in range(int((math.ceil(float(num_items) / num_rows)))) for y in range(num_rows)]

@VictorLamoine
Copy link
Author

@bmagyar would you be so kind as to open a PR and fix this?

@wjwwood wjwwood added the bug label Jan 11, 2017
@bmagyar
Copy link
Contributor

bmagyar commented Jan 19, 2017

Sure, I am looking at it now. Is there a reason you have it open or just found this corner-case by accident?

@VictorLamoine
Copy link
Author

By accident!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants