withrobot / oCam

oCam - USB 3.0 Board Camera
GNU General Public License v3.0
55 stars 62 forks source link

초기 카메라 연결 시 에러 발생 문제 #26

Open hyojoo-cho opened 2 years ago

hyojoo-cho commented 2 years ago

제공받은 Example: opencv-basic_1MGN 을 사용하면 초기 카메라 연결 시, 항상 다음과 같은 에러가 2번 발생합니다.

error number: 11 Cannot get image from camera: Resource temporarily unavailable error number: 11 Cannot get image from camera: Resource temporarily unavailable

또한 제공 받은 example내의 ROS코드를 기반으로 코드를 작성하여도 초기에 카메라를 연결하면 위와 같이 꼭 2회 에러가 발생합니다.

DBG_PRINTF를 켜면 DBG: [withrobot_camera.cpp, 863, get_buffer] Warning :: Different buffer size. v4l2: 0, User: 921600 이라는 메시지가 나옵니다.

보통의 경우 에러 발생이후 문제는 없이 돌아가지만 가끔씩 동작중에 발생하여 에러 복구가 안되어서 프로그램을 재시작해야 하는 경우가 발생합니다. 위의 에러가 발생하였을 때, 커널로그를 확인해 보면 항상 다음과 같은 내용이 나옵니다.

uvcvideo: Non-zero status (-71) in video completion handler.

해당 에러가 왜 발생하는지 알고싶습니다.

fungofljm commented 2 years ago

제공된 Example: opencv-basic_1MGN 소스와 ROS코드를 빌드하여 제 PC에서 테스트를 진행하였습니다.

현재 위에서 말한 현상대로 물리적 연결을 끊거나 하지 않은상태에서 진행하였습니다. 2개의 카메라를 번갈아가면서 총 5개를 테스트 하였으나 재현되지 않았습니다. (현재까지도 카메라를 켜놓고 테스트 진행 중입니다.) 의심되는 부분은 현재 사용중인 PC의 USB포트를 많이 사용하고 있어서라고 생각됩니다. 사용중인 PC의 OS 버전과 PC에 연결된 USB포트 사용개수에 대해 알고싶습니다.

hyojoo-cho commented 2 years ago

제공된 Example: opencv-basic_1MGN 소스와 ROS코드를 빌드하여 제 PC에서 테스트를 진행하였습니다.

  • 1MGN-U 5개
  • uBuntu 18.04
  • PC에 연결된 USB 포트 사용 : 키보드, 마우스, 카메라 2개

현재 위에서 말한 현상대로 물리적 연결을 끊거나 하지 않은상태에서 진행하였습니다. 2개의 카메라를 번갈아가면서 총 5개를 테스트 하였으나 재현되지 않았습니다. (현재까지도 카메라를 켜놓고 테스트 진행 중입니다.) 의심되는 부분은 현재 사용중인 PC의 USB포트를 많이 사용하고 있어서라고 생각됩니다. 사용중인 PC의 OS 버전과 PC에 연결된 USB포트 사용개수에 대해 알고싶습니다.

사용중인 OS: ubuntu 18.04 카메라 펌웨어 버전 : oCam-1MGN-U-T-R2006.img 연결된 usb 포트 : 2개 (키보드, 마우스 콤보 1개, 카메라 1개 모두 usb 3.0)

lsusb -v 를 입력하였을 때 아래와 같이 나옵니다. Bus 002 Device 007: ID 04b4:00f9 Cypress Semiconductor Corp. Couldn't open device, some information will be missing Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 3.10 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 ? bDeviceProtocol 1 Interface Association bMaxPacketSize0 9 idVendor 0x04b4 Cypress Semiconductor Corp. idProduct 0x00f9 bcdDevice 19.06 iManufacturer 1 iProduct 2 iSerial 3 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 384 bNumInterfaces 2 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 100mA Interface Association: bLength 8 bDescriptorType 11 bFirstInterface 0 bInterfaceCount 2 bFunctionClass 14 Video bFunctionSubClass 3 Video Interface Collection bFunctionProtocol 0 iFunction 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 14 Video bInterfaceSubClass 1 Video Control bInterfaceProtocol 0 iInterface 0 VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 1 (HEADER) bcdUVC 1.10 wTotalLength 81 dwClockFrequency 48.000000MHz bInCollection 1 baInterfaceNr( 0) 1 VideoControl Interface Descriptor: bLength 18 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 1 wTerminalType 0x0201 Camera Sensor bAssocTerminal 0 iTerminal 0 wObjectiveFocalLengthMin 0 wObjectiveFocalLengthMax 0 wOcularFocalLength 0 bControlSize 3 bmControls 0x0000200a Auto-Exposure Mode Exposure Time (Absolute) Roll (Absolute) VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 5 (PROCESSING_UNIT) bUnitID 2 bSourceID 1 wMaxMultiplier 16384 bControlSize 3 bmControls 0x00000001 Brightness iProcessing 0 bmVideoStandards 0x 0 VideoControl Interface Descriptor: bLength 28 bDescriptorType 36 bDescriptorSubtype 6 (EXTENSION_UNIT) bUnitID 3 guidExtensionCode {ffffffff-ffff-ffff-ffff-ffffffffffff} bNumControl 0 bNrPins 1 baSourceID( 0) 2 bControlSize 3 bmControls( 0) 0x00 bmControls( 1) 0x00 bmControls( 2) 0x00 iExtension 0 VideoControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 3 (OUTPUT_TERMINAL) bTerminalID 4 wTerminalType 0x0101 USB Streaming bAssocTerminal 0 bSourceID 3 iTerminal 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 bMaxBurst 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 14 Video bInterfaceSubClass 2 Video Streaming bInterfaceProtocol 0 iInterface 0 VideoStreaming Interface Descriptor: bLength 14 bDescriptorType 36 bDescriptorSubtype 1 (INPUT_HEADER) bNumFormats 1 wTotalLength 237 bEndPointAddress 132 bmInfo 0 bTerminalLink 4 bStillCaptureMethod 1 bTriggerSupport 1 bTriggerUsage 0 bControlSize 1 bmaControls( 0) 27 VideoStreaming Interface Descriptor: bLength 27 bDescriptorType 36 bDescriptorSubtype 4 (FORMAT_UNCOMPRESSED) bFormatIndex 1 bNumFrameDescriptors 4 guidFormat {59383030-0000-1000-8000-00aa00389b71} bBitsPerPixel 8 bDefaultFrameIndex 1 bAspectRatioX 0 bAspectRatioY 0 bmInterlaceFlags 0x00 Interlaced stream or variable: No Fields per frame: 2 fields Field 1 first: No Field pattern: Field 1 only bCopyProtect 0 VideoStreaming Interface Descriptor: bLength 46 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 1 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 960 dwMinBitRate 147456000 dwMaxBitRate 530841600 dwMaxVideoFrameBufferSize 2073600 dwDefaultFrameInterval 185185 bFrameIntervalType 5 dwFrameInterval( 0) 185185 dwFrameInterval( 1) 200000 dwFrameInterval( 2) 333333 dwFrameInterval( 3) 400000 dwFrameInterval( 4) 666666 VideoStreaming Interface Descriptor: bLength 46 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 2 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 720 dwMinBitRate 110592000 dwMaxBitRate 442368000 dwMaxVideoFrameBufferSize 921600 dwDefaultFrameInterval 166666 bFrameIntervalType 5 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 200000 dwFrameInterval( 2) 333333 dwFrameInterval( 3) 400000 dwFrameInterval( 4) 666666 VideoStreaming Interface Descriptor: bLength 54 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 3 bmCapabilities 0x01 Still image supported wWidth 640 wHeight 480 dwMinBitRate 36864000 dwMaxBitRate 245760000 dwMaxVideoFrameBufferSize 307200 dwDefaultFrameInterval 100000 bFrameIntervalType 7 dwFrameInterval( 0) 100000 dwFrameInterval( 1) 111111 dwFrameInterval( 2) 166666 dwFrameInterval( 3) 200000 dwFrameInterval( 4) 333333 dwFrameInterval( 5) 400000 dwFrameInterval( 6) 666666 VideoStreaming Interface Descriptor: bLength 50 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 4 bmCapabilities 0x01 Still image supported wWidth 320 wHeight 240 dwMinBitRate 30720000 dwMaxBitRate 110592000 dwMaxVideoFrameBufferSize 76800 dwDefaultFrameInterval 55555 bFrameIntervalType 6 dwFrameInterval( 0) 55555 dwFrameInterval( 1) 66666 dwFrameInterval( 2) 83333 dwFrameInterval( 3) 100000 dwFrameInterval( 4) 166666 dwFrameInterval( 5) 200000 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x84 EP 4 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 0

Transfer Type 이 Bulk 로 나오는 경우, 문제가 발생할 수 있다고 들었는데 혹시 isochronous 로 변경하는 방법은 무엇인가요?

fungofljm commented 2 years ago

카메라 펌웨어 버전 : oCam-1MGN-U-T-R2006.img (해당 이미지는 T : 트리거 모드를 의미 합니다.)

hyojoo-cho commented 2 years ago

트리거가 달려있는 모델이라서 해당 펌웨어를 사용했는데 그러면 무조건 트리거없는 모델의 펌웨어를 사용해야하나요??

2022년 3월 8일 (화) 오전 11:41, fungofljm @.***>님이 작성:

카메라 펌웨어 버전 : oCam-1MGN-U-T-R2006.img (해당 이미지는 T : 트리거 모드를 의미 합니다.)

  • 카메라 펌웨어가 잘못 됬습니다. 위 펌웨어의 경우 Bulk로 동작을 합니다. oCam-1MGN-U-R1906.img 펌웨어의 경우
  • USB 2.0 : Bulk
  • USB 3.0 : Isochronous 로 동작 합니다.

— Reply to this email directly, view it on GitHub https://github.com/withrobot/oCam/issues/26#issuecomment-1061347872, or unsubscribe https://github.com/notifications/unsubscribe-auth/AII33P2RWSF3THHYWVYSEYLU62465ANCNFSM5PVVYWSQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

fungofljm commented 2 years ago

withrobot@withrobot.com 메일로 펌웨어를 참조해서 보낼 예정입니다. 만약 다른 내용이거나 연락이 없다면 메일을 남겨주시기 바랍니다.