Incorrect Laser Values in Course Project Part 1 of Ros Basics in 5 days

I am trying to understand the range of values on the laser so I keep the robot in somewhere near the bottom left corner as in the picture


As per my understanding the values should increase from the right side of the laser to the left. However these are the values that I am getting.

(0.45766258239746094, 0.45737266540527344, 0.45988601446151733, 0.46240511536598206, 0.4634401202201843, 0.4568997323513031, 0.46293890476226807, 0.46756425499916077, 0.4444597661495209, 0.48161378502845764, 0.4772106111049652, 0.4718197286128998, 0.48638761043548584, 0.4934210479259491, 0.4968414306640625, 0.46711093187332153, 0.4895056486129761, 0.46977031230926514, 0.47030818462371826, 0.5004435181617737, 0.5017695426940918, 0.5134517550468445, 0.4952360689640045, 0.507992148399353, 0.49624744057655334, 0.5003706812858582, 0.508707582950592, 0.526946485042572, 0.5361310243606567, 0.5365089774131775, 0.5463898181915283, 0.5438351035118103, 0.538591742515564, 0.5415530204772949, 0.5361226797103882, 0.5163414478302002, 0.5282402038574219, 0.4889456331729889, 0.500724196434021, 0.4808792769908905, 0.477669894695282, 0.456587553024292, 0.4484412670135498, 0.4220806956291199, 0.4439069330692291, 0.42976874113082886, 0.4251199960708618, 0.4358591139316559, 0.4365881681442261, 0.4023384153842926, 0.397654265165329, 0.3956596553325653, 0.3481982946395874, 0.3707472085952759, 0.372199684381485, 0.3665905296802521, 0.35919418931007385, 0.37372490763664246, 0.3436022102832794, 0.37421149015426636, 0.3674962520599365, 0.3430381119251251, 0.35846954584121704, 0.3290184438228607, 0.3450523614883423, 0.3485022187232971, 0.33103400468826294, 0.3313524127006531, 0.3408564031124115, 0.333779513835907, 0.3496687710285187, 0.3225274980068207, 0.3063840866088867, 0.32180243730545044, 0.3160872459411621, 0.3220059871673584, 0.3263137936592102, 0.31409162282943726, 0.307158499956131, 0.2930839955806732, 0.3104185461997986, 0.2996295392513275, 0.3102899193763733, 0.30677399039268494, 0.3073360025882721, 0.29959097504615784, 0.3214713931083679, 0.3077608346939087, 0.30313536524772644, 0.30256372690200806, 0.31027352809906006, 0.3158954679965973, 0.31654030084609985, 0.31924566626548767, 0.31303131580352783, 0.3160797357559204, 0.3312133848667145, 0.30808889865875244, 0.3153231739997864, 0.3130093216896057, 0.30647701025009155, 0.32015979290008545, 0.3236110806465149, 0.3154882788658142, 0.3212578594684601, 0.32886040210723877, 0.33793526887893677, 0.33691418170928955, 0.3239344656467438, 0.3135828971862793, 0.3380480408668518, 0.33781111240386963, 0.3226586878299713, 0.33091408014297485, 0.3547520935535431, 0.3488277792930603, 0.36762773990631104, 0.3610915541648865, 0.34530994296073914, 0.34814417362213135, 0.35581696033477783, 0.37123534083366394, 0.3704216182231903, 0.3689110577106476, 0.3927314877510071, 0.3864608108997345, 0.3978842496871948, 0.3795384466648102, 0.393412709236145, 0.40892356634140015, 0.41913914680480957, 0.43529212474823, 0.4295932650566101, 0.4250591993331909, 0.4374566078186035, 0.45468151569366455, 0.46396201848983765,0.4624020755290985, 0.4604286253452301, 0.49997690320014954, 0.495614618062973, 0.506272554397583, 0.5176283717155457, 0.5324913263320923, 0.5627375245094299, 0.5595601201057434, 0.5763397812843323, 0.5948168635368347, 0.6299914121627808, 0.6467413306236267, 0.6618316769599915, 0.6844555139541626, 0.7080205678939819, 0.718226432800293, 0.7582366466522217, 0.7793160676956177, 0.8363256454467773, 0.8625485897064209, 0.9056888818740845, 0.9634799361228943, 1.003408432006836, 1.0709221363067627, 1.1155788898468018, 1.1882730722427368, 1.2732317447662354, 1.392918586730957, 1.3844350576400757, 1.3786979913711548, 1.39220130443573, 1.369314193725586, 1.3762893676757812, 1.3573565483093262, 1.372052550315857, 1.3765661716461182, 1.3759273290634155, 1.362156867980957, 1.3393895626068115, 1.3629735708236694, 1.362701416015625, 1.3648290634155273, 1.3462973833084106, 1.3576527833938599, 1.3706457614898682, 1.3594756126403809, 1.3615878820419312, 1.3514740467071533, 1.367093801498413, 1.3636329174041748, 1.3846544027328491, 1.3932069540023804, 1.3854085206985474, 1.3803703784942627, 1.4057737588882446, 1.4220356941223145, 1.4117244482040405, 1.407845139503479, 1.4102787971496582,1.4335929155349731, 1.4450122117996216, 1.4575308561325073, 1.4543554782867432, 1.4717905521392822, 1.497705101966858, 1.507440209388733, 1.503757119178772, 1.5418720245361328, 1.5454614162445068, 1.5614042282104492, 1.5625555515289307, 1.5898569822311401, 1.6196469068527222, 0.6604335308074951, 0.6709891557693481, 0.6834691166877747, 0.694719672203064, 0.6694955229759216, 0.6798296570777893,0.6920322775840759, 0.7024064660072327, 0.5807684659957886, 0.557281494140625, 0.56849205493927, 0.5494778752326965, 0.5788892507553101, 0.590097188949585, 0.590650737285614, 0.5754772424697876, 0.582115650177002, 0.5948261618614197, 0.6816440224647522, 0.6803863644599915, 0.6899181008338928, 0.6684351563453674, 0.6913170218467712, 0.6987415552139282, 0.7016839981079102, 2.066413640975952, 1.2004598379135132, 1.210057258605957, 1.2224310636520386, 1.2289526462554932, 1.9522117376327515, 1.9598298072814941, 1.936719298362732, 1.9303895235061646, 1.8848994970321655, 1.8750230073928833, 1.171779990196228, 1.091581106185913, 1.089590311050415, 1.1117311716079712, 1.1327764987945557, 1.8262914419174194, 1.7967654466629028, 1.7995978593826294, 1.7794805765151978, 1.802270531654358, 1.795499563217163, 1.771226406097412, 1.7764592170715332, 1.775747537612915, 1.7579175233840942, 1.7587125301361084, 1.7485605478286743, 1.7604200839996338, 1.7502481937408447, 1.761665940284729, 1.7684155702590942, 1.7536232471466064, 1.7547696828842163, 1.7495158910751343, 1.7602691650390625, 1.7697571516036987, 1.7753723859786987, 1.7555227279663086, 1.7747018337249756, 1.774643898010254, 1.7754039764404297, 1.7843694686889648, 1.801511526107788, 1.7908378839492798, 1.8049272298812866, 1.7915959358215332, 1.719283103942871, 1.6171444654464722, 1.5467288494110107, 1.4561443328857422, 1.3711447715759277, 1.319226622581482, 0.7574495077133179, 0.7367842197418213, 0.741550862789154, 0.7240128517150879, 0.7157444357872009, 0.7099963426589966, 0.9905376434326172, 0.9525344967842102, 0.9335363507270813, 0.9031702280044556, 0.8853455185890198, 0.8458364009857178, 0.8648041486740112, 0.8149782419204712, 0.7959050536155701, 0.7561257481575012, 0.7612028121948242, 0.7370176911354065, 0.7423316836357117, 0.7081595659255981, 0.7112141847610474, 0.6910663843154907, 0.6562374830245972, 0.6585683226585388, 0.6301109790802002, 0.6371744275093079, 0.6135005950927734, 0.6093813180923462, 0.600428581237793, 0.5911675691604614, 0.5902130603790283, 0.5785397291183472, 0.5605062246322632, 0.5670309066772461, 0.5344839692115784, 0.5426127314567566, 0.5491223931312561, 0.532565176486969, 0.5265817046165466, 0.5237036943435669, 0.5174288749694824, 0.5184686779975891, 0.5064498782157898, 0.5010533928871155, 0.5197751522064209, 0.511588990688324, 0.5050473809242249, 0.4898233115673065, 0.4845542907714844, 0.5146804451942444, 0.49350792169570923, 0.4561493396759033, 0.4766533076763153, 0.46648770570755005, 0.4799822270870209, 0.4529428482055664, 0.46792271733283997, 0.45038124918937683, 0.4704132676124573, 0.4806531071662903, 0.47076258063316345, 0.4842279553413391, 0.46872690320014954, 0.4505198299884796, 0.45437169075012207, 0.4668974280357361, 0.4678471088409424, 0.49215447902679443, 0.4635048806667328, 0.44805091619491577, 0.4577829837799072)

The values for right and left rays are similar even if the right side is much more close to the wall than the left size is.
Am I doing something wrong?
The code for now is simply a subscriber to ‘/scan’ topic that prints the ranges

Hi, welcome to the community!

No, you are not doing anything wrong. Like you said, the scan values are “reversed.” The reason for this is because of the setup of the actual robot, where the hardware has to be the way it is. If you look at the frame of the scan element (you can use RViZ for this) you’ll see that the scan frame has a 180 degree offset.

You’ll have to keep this in mind as you create your program.

Thanks! I did the exercise with the info you provided. The RViZ tip was especially useful.

1 Like

Hey,
I am really stuck. Been here on part 1 for the last 3 days. I am unable to move forward with the bot. I am not sure what I am missing. The bot is going in rounds and not following the wall behavior and I am pretty sure it has something to do with the laser values.

Please help.

Hi, did you look at this thread explaining the “reversal” of the laserscan values? Please share more information, I can’t help you unless I know how you are approaching the problem

Thank you for the reply. Actually, I was able to solve this. I was stuck with the orientation of the laser with the x,y,z axes of the turtlebot(preferably the x-axis). After figuring that out (also I saw it was written as well in the notebook), I could move the bot exactly the way it was required in the course. But on a similar line of questions, I want to ask how can I check the index values of the ranges array as in the length of the array? I am doing this in cpp.

1 Like