{"action":"closed","issue":{"url":"https://api.github.com/repos/scanse/sweep-sdk/issues/122","repository_url":"https://api.github.com/repos/scanse/sweep-sdk","labels_url":"https://api.github.com/repos/scanse/sweep-sdk/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/scanse/sweep-sdk/issues/122/comments","events_url":"https://api.github.com/repos/scanse/sweep-sdk/issues/122/events","html_url":"https://github.com/scanse/sweep-sdk/issues/122","id":265250961,"number":122,"title":"Laggy values from Sweep with piCamera integration in Raspberry pi 3 b","user":{"login":"Biswajit1995","id":25642248,"avatar_url":"https://avatars1.githubusercontent.com/u/25642248?v=4","gravatar_id":"","url":"https://api.github.com/users/Biswajit1995","html_url":"https://github.com/Biswajit1995","followers_url":"https://api.github.com/users/Biswajit1995/followers","following_url":"https://api.github.com/users/Biswajit1995/following{/other_user}","gists_url":"https://api.github.com/users/Biswajit1995/gists{/gist_id}","starred_url":"https://api.github.com/users/Biswajit1995/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Biswajit1995/subscriptions","organizations_url":"https://api.github.com/users/Biswajit1995/orgs","repos_url":"https://api.github.com/users/Biswajit1995/repos","events_url":"https://api.github.com/users/Biswajit1995/events{/privacy}","received_events_url":"https://api.github.com/users/Biswajit1995/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-10-13T11:01:28Z","updated_at":"2018-04-13T09:40:23Z","closed_at":"2018-04-13T09:40:22Z","author_association":"NONE","body":"Hey There,\r\n\r\nI am having a issue while integrating Sweep code with one of my code that I was using previously.\r\n\r\nActually as I am working with Raspberry pi (Model 3B), I'm more comfortable with Python, and I am using python3 for the development.\r\n\r\nMy previous code was simple code to take pictures frame by frame from the RaspiCam and use it after some image processing.(Sorry, I can't post the code over here) but it is fairly simple like the below code snippet: \r\n\r\n```\r\ncap = cv2.VideoCapture(camera_index)\r\ncap.set(3, any_resolution)\r\ncap.set(4, any_resolution)\r\ncap.set(5, frame_rate)\r\n```\r\n\r\nthen under a continuous loop I'm using `cap.read()` to read out frames and passing them through my another set of code to process and use it.\r\n\r\nAnd It was working perfectly fine unless I started to use it with Sweep Lidar code, from the SDK sweeppy I'm using their startup code [(Here)](https://github.com/scanse/sweep-sdk/blob/master/sweeppy/README.md), and since in the Interface scan.get_scans() is returning an Iterable of Sample class which in turn is a class, I'm accessing it through two for loops as mentioned below:\r\n\r\n```\r\nfrom sweeppy import Sweep\r\nwith Sweep('port') as sweep:\r\n    sweep.start_scanning()\r\n\r\n    for scan in sweep.get_scans():\r\n        for i in scan:\r\n            for j in i:\r\n                print(j.angle/1000, j.distance)\r\n```\r\nand it was perfectly fine without any lag.\r\nThe main problem arises when I integrate this piece of code with `cap.read()` something similar to the below one:\r\n\r\n```\r\nfrom sweeppy import Sweep\r\nwith Sweep('port') as sweep:\r\n    sweep.start_scanning()\r\n\r\n    for scan in sweep.get_scans():\r\n        for i in scan:\r\n            for j in i:\r\n                 flag, frame = cap.read()\r\n                 print(flag)     # To check the camera read is successful or not\r\n                 print(j.angle/1000, j.distance)\r\n```\r\n\r\nhere, in the output , its only prints True, or false(In case of camera failure), but not printing the j.angle and j.distance values as it was printing before, there is huge lag, means after 1 min 5 values will get printed then again it will print True or False and it goes on like that.\r\n\r\noutput example:\r\n\r\n```\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\n(240, 56)\r\nTrue\r\n(98, 578)\r\nTrue\r\n(340, 568)\r\nTrue\r\n(45, 678)\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\nTrue\r\n\r\n```\r\nI don't know why it is behaving like that, any help with this would be great.\r\n\r\nAnd one more thing I want to ask is that, is it necessary to use sweeppy SDK with\r\n`with Sweep('dev') as sweep:` part, is there any alternative to this.\r\n\r\nRegards\r\nBiswajit"}}
{"actor":{"display_login":"daniel-j-h"}}