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

Cut at specified angle leads to deadlock #174

Closed
sts-thm opened this issue Jun 20, 2018 · 1 comment
Closed

Cut at specified angle leads to deadlock #174

sts-thm opened this issue Jun 20, 2018 · 1 comment

Comments

@sts-thm
Copy link
Contributor

sts-thm commented Jun 20, 2018

The cut_angle parameter and functionality introduced by #138 leads to a deadlock inside a while(true)-loop, for specific values of the cut_angle parameter in relation to the FOV specified in the velodyne's user interface.
I found out about this issue using a VLP16 and commit ef2345e of this repository.
There are several possible configurations for the relation between the two angles (Start, Stop) specifying the FOV of the velodyne in the velodyne's user interface and the cut_angle parameter (c):

  1. 0° < Start < c < Stop < 360°
  2. 0° < c < Start < Stop < 360°
  3. 0° < Start < Stop < c < 360° <- bad case
  4. 0° < Stop < c < Start < 360°
  5. 0° < c < Stop < Start < 360°
  6. 0° < Stop < Start < c < 360°

For the 3rd configuration the break in the while(true) (https://github.com/ros-drivers/velodyne/blob/master/velodyne_driver/src/driver/driver.cc#L189) is never reached and the loop will never stop.
My solution to this was to replace the lines 180-186 in https://github.com/ros-drivers/velodyne/blob/master/velodyne_driver/src/driver/driver.cc with:

      //if first packet in scan, there is no "valid" last_azimuth
      if (last_azimuth == -1) {
  	 last_azimuth = azimuth;
      	 continue;
      }
      if((last_azimuth < config_.cut_angle && config_.cut_angle <= azimuth)
      	 || ( config_.cut_angle <= azimuth && azimuth < last_azimuth)
      	 || (azimuth < last_azimuth && last_azimuth < config_.cut_angle))

I tested this with the same configurations and it worked.
If you want me to, I can submit a pull request for my fix.

@JWhitleyWork
Copy link
Contributor

Sorry I didn't get to this sooner. I never saw the notification. Please do submit a PR and I will get it tested/reviewed.

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

No branches or pull requests

2 participants