SICKAG / sick_safetyscanners

ROS driver for SICK safety laser scanners
https://www.sick.com/de/en/opto-electronic-protective-devices/safety-laser-scanners/c/g187225
Apache License 2.0
61 stars 59 forks source link

Wrong min angle #129

Closed zhibopotame closed 1 year ago

zhibopotame commented 1 year ago

Hello, in reconfigureCallback function in the ros node if (config.angle_start == config.angle_end) { m_communication_settings.setStartAngle(sick::radToDeg(0)); m_communication_settings.setEndAngle(sick::radToDeg(0)); } else { m_communication_settings.setStartAngle(sick::radToDeg(config.angle_start) - m_angle_offset); m_communication_settings.setEndAngle(sick::radToDeg(config.angle_end) - m_angle_offset); } the input start angle can be negative here, but the m_communication_settings.setStartAngle function's input is unint32_t, if we set start angle = -2.3998 and end angle slightly different, we will see a chunk of laser disapeared, please verify it there is a bug in the input value.

puck-fzi commented 1 year ago

Hi,

i am not exactly understanding what the error is. When you only have a small window between your angles, the majority of the scan will disappear and only the area in between will be published. If the values are equal, the complete area will be published

zhibopotame commented 1 year ago

@puck-fzi Thanks for replying. What we've experienced is that by setting m_communication_settings.setStartAngle(sick::radToDeg(-2.3998) - m_angle_offset); m_communication_settings.setEndAngle(sick::radToDeg(2.3998) - m_angle_offset); not setting them both to 0, we had a portion of laser disapeared as shown in the picture. What I've been trying to say is, maybe to reproduce the same in ROS, just put the start angle and end angle slighly different in the dynamic reconfig, to avoid this condition if (config.angle_start == config.angle_end), and see the laser coverage visualization in Rviz. 20230602084716

chenfumin196 commented 1 year ago

Hello, I encountered the same problem, how do I set the values of angle_start and angle_end for an angle of 230 degrees in the launch file. thanks

puck-fzi commented 1 year ago

@puck-fzi Thanks for replying. What we've experienced is that by setting m_communication_settings.setStartAngle(sick::radToDeg(-2.3998) - m_angle_offset); m_communication_settings.setEndAngle(sick::radToDeg(2.3998) - m_angle_offset); not setting them both to 0, we had a portion of laser disapeared as shown in the picture. What I've been trying to say is, maybe to reproduce the same in ROS, just put the start angle and end angle slighly different in the dynamic reconfig, to avoid this condition if (config.angle_start == config.angle_end), and see the laser coverage visualization in Rviz. 20230602084716

When I set the parameters as you suggest, i get the whole scan area. I will have a look however, if there is something, which is faulty.

puck-fzi commented 1 year ago

Hello, I encountered the same problem, how do I set the values of angle_start and angle_end for an angle of 230 degrees in the launch file. thanks

For a 230 degrees you should put the corresponding radian values in the launch file. So for your case your range would be [-2.0071285, 2.0071285]

chenfumin196 commented 1 year ago

Thank you for replying. I have tried this value[-2.0071285, 2.0071285],this is the result f58a1443211af534099f2b7ce454982 it seems that the angle_start values is unequal, compared to others, When I set a continuously changing value, the value of angle_end is displayed correctly ,this makes me feel confused.

Playfish commented 1 year ago

Hi @puck-fzi , Is the following line correct?

https://github.com/SICKAG/sick_safetyscanners/blob/832d20f65ff76152561b8cb7ba7fe11a26164aa5/include/sick_safetyscanners/datastructure/CommSettings.h#L151

When I set start_angle with -0.677885881, the topic's angle_min is not -0.677885881. Thanks.

Raymond601 commented 1 year ago

@puck-fzi would you please help to check above reply? thank you very much!

puck-fzi commented 1 year ago

I will check if this is according to the specifications of the sensor or if it should be a signed int. However, this will take another two weeks since I am currently on a conference. I'll try to get back to you as soon as possible

puck-fzi commented 1 year ago

Hi @puck-fzi , Is the following line correct?

https://github.com/SICKAG/sick_safetyscanners/blob/832d20f65ff76152561b8cb7ba7fe11a26164aa5/include/sick_safetyscanners/datastructure/CommSettings.h#L151

When I set start_angle with -0.677885881, the topic's angle_min is not -0.677885881. Thanks.

Hi, I am currently looking into this issue. Could you elaborate a bit more on what you are seeing. I would need to know:

The more details you can give me the better, is it a source build (if so, which commit) or is it installed. On which plattform, whic compiler version etc. The more details you can pass on the better i might be able to udnerstand whats going wrong

Playfish commented 1 year ago

Hi @puck-fzi

Basic software information:

Basic information before modification

The configuration of ros parameters in yaml:

The output angle_min and angle_max in ROS topic is:

After modification:

When I change angle_start and angle_end to:

The output angle_min and angle_max in ROS topic is:

Expected Result:

The expected result above is that change angle_start should be equal with angle_min in ROS topic, like:

ROS topic's angle_min and angle_max should be:

Please tell me whether the above information is sufficient. Thanks

puck-fzi commented 1 year ago

Thank you for the information. Please verify that the results are the same under version 1.0.9.

Either way, I will have a look into the error

Raymond601 commented 1 year ago

Hi @puck-fzi , we tried the newest version 1.0.9, but the result is the same...

puck-fzi commented 1 year ago

Alright, thanks for letting me know

puck-fzi commented 1 year ago

Please checkout the following branch and let me know if that fixed your issue: https://github.com/SICKAG/sick_safetyscanners/tree/fb_fix_for_angles

Playfish commented 1 year ago

Thanks, for now I test about 35 times with 15 restart ROS node and 10 reconnect device with run ROS node.

A UDP connection occurred but no data was published at first time when I reconnect device and run ROS node.

Other times the topic has changed to correct angle_start(-0.629031) and angle_stop(3.770663)

Please let me know the UDP connection but not data was published whether it can be solved.

puck-fzi commented 1 year ago

Thanks for letting me know, that the fix worked. I will integrate it into the main branch.

Once its merged, I will close this issue. For the reconnects this is currently not implemented, however there is an untested MR https://github.com/SICKAG/sick_safetyscanners/pull/131 which includes a version of a reconnect

Playfish commented 1 year ago

Hi, I found other issue is that nanoScan3 ros data of topic will rotate aboute 90°, like under images: normal data: normal_data

rotate 90° with other nanoScan3: rotate_90_data

This problem is extremely unlikely, can you help me find out why? Thanks.

puck-fzi commented 1 year ago

Hi, please open another issue for the new error.

puck-fzi commented 1 year ago

Merged fix for min angle