Velodyne 16 - PCL : How to dynamically calculate the distance of an object and publish the result

asked 2019-12-30 11:17:58 -0500

RayROS gravatar image

I successfully connected my Velodyne VLP-16 to my Ubuntu 18-04. I have the melodic version. After following the official guideline and making the proper modification I can finally see the outcome on RViz as shown below. The reference frame is the sensor. Also below is the result of the /scan topic only and the red circle represent a small line detected by the Velodyne VLP-16 (which is a box in my case). I would like to calculate the distance from this line to the sensor :

laserScan

emanuele@pc:~$ rostopic echo /scan 
header: 
  seq: 756
  stamp: 
    secs: 1577714569
    nsecs:  21788000
  frame_id: "velodyne"
angle_min: -3.14159274101
angle_max: 3.14159274101
angle_increment: 0.00700000021607
time_increment: 0.0
scan_time: 0.0
range_min: 0.0
range_max: 200.0
ranges: [1.4277827739715576, 1.4317818880081177, 1.4197838306427002, 1.4037861824035645, 1.4077856540679932, 1.3877886533737183, 1.3877886533737183, 1.37978994846344, 1.3557935953140259, 1.3677916526794434, 1.3437954187393188, 1.347794771194458, 1.3317971229553223, 1.3197990655899048, 1.3237985372543335, 1.3078008890151978, 1.3098005056381226, 1.2958025932312012, 1.2798051834106445, 1.2798051834106445, 1.267806887626648, 1.2758057117462158, 1.2558088302612305, 1.2478100061416626, 1.2538090944290161, 1.23781156539917, 1.2338122129440308, 1.2318124771118164, 1.2238136529922485, 1.2198141813278198, 1.2038167715072632, 1.2118154764175415, 1.1958179473876953, 1.2078161239624023, 1.1918184757232666, 1.1878191232681274, 1.1918184757232666, 1.1678223609924316, 1.1758209466934204, 1.1758209466934204, 1.1638227701187134, 1.163822889328003, 1.1518245935440063, 1.1558239459991455, 1.1478251218795776, 1.1398265361785889, 1.1518244743347168, 1.1258286237716675, 1.137826681137085, 1.1258286237716675, 1.1178297996520996, 1.1258286237716675, 1.111830711364746, 1.1198294162750244, 1.1118308305740356, 1.099832534790039, 1.1178297996520996, 1.0918337106704712, 1.111830711364746, 1.0918337106704712, 1.087834358215332, 1.0998324155807495, 1.0818352699279785, 1.0838350057601929, 1.0718368291854858, 1.063838005065918, 1.075836181640625, 1.063838005065918, 1.063838005065918, 1.0598386526107788, 1.05583918094635, 1.0618382692337036, 1.0538395643234253, 1.0658377408981323, 1.0498402118682861, 1.0538395643234253, 1.0538395643234253, 1.0538395643234253, 1.05583918094635, 1.0418413877487183, 1.0578389167785645, 1.0298430919647217, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, 0.5119220614433289, 1.007846474647522, 0.8958635926246643, 0.7578845620155334, 0.7818809747695923, 0.7658833861351013, 0.803877592086792, 0.7878800630569458, 0.7978785037994385, 0.7838807106018066, 0.9998476505279541, 1.0238441228866577, 0.7098919153213501, 0.7258895039558411, 0.7158910036087036, 0.7158910036087036, 0.7158909440040588, 0.7058925032615662, 0.7158910036087036, 0.7038928270339966, 0.7158910036087036, 0.7078921794891357, 0.7078921794891357, 0.713891327381134, 0.7018930912017822, 0.7058925032615662, 0.6958940029144287, 0.6878952980041504, 0.7038928270339966, 0.6838958263397217, 0.6958940625190735, 0.6978937387466431, 0.685895562171936, 0.7058925032615662, 0.6978937387466431, 0.7198903560638428, 0.7038928270339966, 0.7038928270339966, 0.7118............]
intensities: [95.0, 95.0, 99.0, 100.0, 92.0, 100.0, 100.0, 100.0, 100.0, 100.0, 99.0, 95.0, 100.0, 100.0, 100.0, 99.0, 100.0, 96.0, 96.0, 94.0, 98.0, 98.0, 94.0, 96.0, 94.0, 98.0, 98.0, 100.0, 99.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 99.0, 100.0, 100.0, 100.0, 100 ...
(more)
edit retag flag offensive close merge delete