PepperlFuchs / pf_lidar_ros_driver

ROS driver for Pepperl+Fuchs R2000 and R2300 laser scanners
https://www.pepperl-fuchs.com/global/en/23097.htm
Apache License 2.0
39 stars 38 forks source link

WIP ROS2 #114

Closed dlutjwh closed 1 year ago

dlutjwh commented 1 year ago

the code can run on ros2, i have tested it, but there is a issue: Every once in a while a laser frame loses data about 90 degrees, which is not regularly。If it is convenient, I can send the bag to your email。 by print the data, the lost points actually are all (0,0),which ranges are all 0。more specifically,now every scan frame output 1400 points, divided to 5 packets, each with 332,332,332,332 and 72 points。 the ranges of the fourth packet of the wrong frame are all zero,which means the corresponding 332 points are all (0,0) in laser frame。 are there any params i ignored to set? or any other reasons. thanks the correct data frame: 2023-03-14 19-14-15 的屏幕截图

the Incorrect data frame: 2023-03-14 19-15-02 的屏幕截图

dlutjwh commented 1 year ago

whats more, is the default points num 1400? i didnot set the param samples_per_scan ,and the max_num_points_scan is 0。the driver output 1400 points every frame。is it a normal result?

hsd-dev commented 1 year ago

@dlutjwh thanks for the PR! memcpy was a good way to go. I have left some comments, please address them.

Also, a secondary issue, but for the checks to pass, please fix the formatting: https://github.com/PepperlFuchs/pf_lidar_ros_driver/actions/runs/4415119435/jobs/7738887711#step:4:187

dlutjwh commented 1 year ago

@dlutjwh thanks for the PR! memcpy was a good way to go. I have left some comments, please address them.

Also, a secondary issue, but for the checks to pass, please fix the formatting: https://github.com/PepperlFuchs/pf_lidar_ros_driver/actions/runs/4415119435/jobs/7738887711#step:4:187

@ipa-hsd i have fixed the format。 emm “ I have left some comments, please address them.”, i'm sorry but where are the comments?

hsd-dev commented 1 year ago

i'm sorry but where are the comments?

You should be able to see the comments if you scroll up the conversation. Or you can see it inline with the code here: https://github.com/PepperlFuchs/pf_lidar_ros_driver/pull/114/files

dlutjwh commented 1 year ago
dlutjwh commented 1 year ago

i'm sorry but where are the comments?

You should be able to see the comments if you scroll up the conversation. Or you can see it inline with the code here: https://github.com/PepperlFuchs/pf_lidar_ros_driver/pull/114/files

i'm sorry but i really cannot find your comments for my code, have you left it? may you send a screenshot of the comments where it is ,so i can find. thanks。

hsd-dev commented 1 year ago

Screenshot from 2023-03-15 10-49-29 Screenshot from 2023-03-15 10-49-46

@dlutjwh

dlutjwh commented 1 year ago

I really can't see your comments, and i will adress the commens by your screenshot: 2023-03-15 18-34-36 的屏幕截图

comments1: in order to analysis data from char *, i used reinterpret_cast(char type) ,because i failed to use de-serialization in ros2. sure ,if reinterpret_cast(char type) is ok, we can use it no problem at all. in addition, in my own code, i need to delete all the Custom ros2 msg for less msg to build, so i use struct type.

comments2: the number 76 is the head length of the header of a packet, like function PFR2000Packet::get_size()。may be it can be calculated more reliablely.

comments3: i tested the origin code for getting params, but failed. so i used simple methods directly.

and i have commented out those codes. @ipa-hsd

hsd-dev commented 1 year ago

if reinterpret_cast(char type) is ok, we can use it no problem at all.

Can you please make that change?

the number 76 is the head length of the header of a packet, like function PFR2000Packet::get_size()。may be it can be calculated more reliably.

And also this. I tried something like this https://github.com/PepperlFuchs/pf_lidar_ros_driver/blob/ef8dd3ba56f67b42c1e4f75c2f4429fc77150ebd/src/pf_driver/include/pf_driver/pf/pf_packet/pf_r2000_packet.h#L10-L13 But I get 18 bytes, which is wrong. I will try again today.

hsd-dev commented 1 year ago

@dlutjwh I have almost completed most of the changes from this PR in https://github.com/PepperlFuchs/pf_lidar_ros_driver/pull/83. I will continue with the remaining changes there, so I will close this PR. I am unable to visualize the points in RViz though, even though I get the scan data when I echo the scan topic. I set the "Reliability Policy" to "Best effort" in RViz. Did you have to do anything more to visualize the laserscan?

chenwu-cc commented 1 year ago

After running, we can receive topic information but cannot receive points. How to solve this problem

chenwu-cc commented 1 year ago

the code can run on ros2, i have tested it, but there is a issue: Every once in a while a laser frame loses data about 90 degrees, which is not regularly。If it is convenient, I can send the bag to your email。 by print the data, the lost points actually are all (0,0),which ranges are all 0。more specifically,now every scan frame output 1400 points, divided to 5 packets, each with 332,332,332,332 and 72 points。 the ranges of the fourth packet of the wrong frame are all zero,which means the corresponding 332 points are all (0,0) in laser frame。 are there any params i ignored to set? or any other reasons. thanks the correct data frame: 2023-03-14 19-14-15 的屏幕截图

the Incorrect data frame: 2023-03-14 19-15-02 的屏幕截图

May I ask how to handle messages that can be received in rviz but do not have point cloud data

hsd-dev commented 1 year ago

@chenwu-cc https://github.com/PepperlFuchs/pf_lidar_ros_driver/pull/83 is the active PR. Could you test that one please? This PR is not being updated anymore.

chenwu-cc commented 1 year ago

@chenwu-cc #83 is the active PR. Could you test that one please? This PR is not being updated anymore.

On the first floor, using portingROS2 can display point clouds, but I cannot display point clouds. This is something strange to me

hsd-dev commented 1 year ago

using portingROS2 can display point clouds, but I cannot display point clouds

I don't understand what do you mean.

chenwu-cc commented 1 year ago

using portingROS2 can display point clouds, but I cannot display point clouds

I don't understand what do you mean.

image

chenwu-cc commented 1 year ago

using portingROS2 can display point clouds, but I cannot display point clouds

I don't understand what do you mean.

I don't know how to solve it.

hsd-dev commented 1 year ago

ah yes I am having the same issue. I will work on it today and get back to you.

hsd-dev commented 1 year ago

The ROS 2 version is being continued on https://github.com/PepperlFuchs/pf_lidar_ros_driver/pull/83 so closing this PR.