Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
stereo_cameras [2019/02/28 17:17] paul created |
stereo_cameras [2019/03/31 14:49] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======= Stereo Cameras ======= | + | ====== |
+ | |||
+ | Here are notes of various | ||
+ | |||
+ | {{:: | ||
+ | |||
+ | |||
+ | ===== E-Con Tara ===== | ||
+ | |||
+ | An machine vision hardware company called E-Conn Systems makes an inexpensive and really great stereo camera called Tara. It is a USB 3.0 Stereo Vision Camera | ||
+ | [[https:// | ||
+ | has excellent accurate PCL creation fromranges of 0.5 meters to 3 meters. Below are outputs from two Tara cameras used on [[primo_robot|Primo]]. An custom self-filter and a voxel-grid-filter were used with the raw PCL output from the cameras. | ||
+ | |||
+ | {{:: | ||
+ | |||
+ | ==== Specs ==== | ||
+ | |||
+ | * 1/3” MT9V024 Monochrome image sensor | ||
+ | * 8-bit/ | ||
+ | * WVGA 752(H) x 480(V) (360690 pixels) | ||
+ | * Depth ranges from 50cm to 300cm | ||
+ | * Baseline distance of 60mm | ||
+ | * S-mount lens holder (M12 P0.5) | ||
+ | |||
+ | ==== General Notes ==== | ||
+ | What a pain in the ass. E-Con systems has a package for the Tara stereo camera that | ||
+ | has the package name of '' | ||
+ | '' | ||
+ | |||
+ | I have been testing the E-Con systems package and it is the way to go. | ||
+ | |||
+ | This driver reads calibration data that is store on flash on the camera and then | ||
+ | automatically generates yaml calibration files for the left and right cameras. | ||
+ | |||
+ | Brightness is from 1 to 7 | ||
+ | Expo is from 10 to 100,000 (can go higher but useless) | ||
+ | |||
+ | ==== uvc_camera ==== | ||
+ | |||
+ | The uvc_camera driver requires a left and right video device. The tara usb cam shows | ||
+ | up as one device and for this reason the uvc_camera library doesn' | ||
+ | |||
+ | ==== udev Rules ==== | ||
+ | |||
+ | I tried the following which makes a symlink for the camera: | ||
+ | |||
+ | < | ||
+ | KERNEL==" | ||
+ | </ | ||
+ | |||
+ | Whenever I launch the tara_node of the e-con systems uvc_package referencing this | ||
+ | symlink I would get an error saying: | ||
+ | |||
+ | < | ||
+ | ================================================================================ | ||
+ | REQUIRED process [stereo/ | ||
+ | process has died [pid 15906, exit code -11, cmd | ||
+ | / | ||
+ | __log: | ||
+ | log file: | ||
+ | / | ||
+ | Initiating shutdown! | ||
+ | ================================================================================ | ||
+ | </ | ||
+ | |||
+ | Oddly enough that log file would not get created. There is some complicated stuff | ||
+ | that the tara stereo camera does with the USB device that gets created that handles | ||
+ | some settings for the camera. My guess is that it uses the device name to reference | ||
+ | the USB device and that's why it's not working. | ||
+ | |||
+ | Moral of the story: symlinks don't work with the tara driver. | ||
+ | |||
+ | ==== USB hidraw device ==== | ||
+ | |||
+ | The Tara stereo USB camera also creates a '' | ||
+ | IMU, get the onboard calibration and I think set exposure. | ||
+ | |||
+ | This device will be mounted as '' | ||
+ | < | ||
+ | cat / | ||
+ | </ | ||
+ | |||
+ | Here is a sample output of the Tara USB device: | ||
+ | < | ||
+ | DRIVER=hid-generic | ||
+ | HID_ID=0003: | ||
+ | HID_NAME=e-con Systems See3CAM_Stereo | ||
+ | HID_PHYS=usb-0000: | ||
+ | HID_UNIQ=19355304 | ||
+ | MODALIAS=hid: | ||
+ | </ | ||
+ | |||
+ | The Tara device creates these USB interfaces (result of '' | ||
+ | < | ||
+ | T: Bus=04 Lev=01 Prnt=01 Port=03 Cnt=02 Dev#= 3 Spd=5000 MxCh= 0 | ||
+ | D: Ver= 3.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 # | ||
+ | P: Vendor=2560 ProdID=c114 Rev=00.00 | ||
+ | S: Manufacturer=e-con Systems | ||
+ | S: Product=See3CAM_Stereo | ||
+ | S: SerialNumber=1A2E5304 | ||
+ | C: #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=800mA | ||
+ | I: If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo | ||
+ | I: If#= 1 Alt= 0 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo | ||
+ | I: If#= 2 Alt= 0 #EPs= 2 Cls=03(HID | ||
+ | I: If#= 3 Alt= 0 #EPs= 1 Cls=03(HID | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Debug Notes ==== | ||
+ | |||
+ | Trying to debug with DDD. The gui is pretty helpful. | ||
+ | |||
+ | Zeroing in on the problem. | ||
+ | |||
+ | |||
+ | |||
+ | Here is a dump of the DeviceInstances: | ||
+ | <code bash> | ||
+ | print DeviceInstances -> | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | device = 0xa4c650 "/ | ||
+ | friendlyname = 0xa31e70 " | ||
+ | bus_info = 0xa31e90 " | ||
+ | vendor = 0xa55520 " | ||
+ | product = 0xa55780 " | ||
+ | deviceID = 2 | ||
+ | |||
+ | device = 0xa4c450 "/ | ||
+ | friendlyname = 0xa4c470 " | ||
+ | bus_info = 0xa4c490 " | ||
+ | vendor = 0xa53d50 " | ||
+ | product = 0xa53fd0 " | ||
+ | deviceID = 4 | ||
+ | |||
+ | device = 0xa502a0 "/ | ||
+ | friendlyname = 0xa502c0 "HD Pro Webcam C920" | ||
+ | bus_info = 0xa502e0 " | ||
+ | vendor = 0xa51bf0 " | ||
+ | product = 0xa51e50 " | ||
+ | deviceID = 5 | ||
+ | |||
+ | device = 0xa52290 "/ | ||
+ | friendlyname = 0xa522b0 " | ||
+ | bus_info = 0xa522e0 " | ||
+ | vendor = 0xa46a70 " | ||
+ | product = 0xa4ac00 " | ||
+ | deviceID = 0 | ||
+ | |||
+ | |||
+ | device = 0xa4ac40 "/ | ||
+ | friendlyname = 0xa4ac60 "ZED: ZED" | ||
+ | bus_info = 0xa58e20 " | ||
+ | vendor = 0xa59e10 " | ||
+ | product = 0xa59560 " | ||
+ | deviceID = 3 | ||
+ | |||
+ | device = 0xa59000 "/ | ||
+ | friendlyname = 0xa59020 " | ||
+ | bus_info = 0xa59050 " | ||
+ | vendor = 0xa61b60 " | ||
+ | product = 0xa61de0 " | ||
+ | deviceID = 1 | ||
+ | </ | ||
+ | |||
+ | ===== Custom Stereo Camera ===== | ||
+ | |||
+ | I built a stereo camera from scratch using USB3 monocular cameras, and by | ||
+ | building a variable hardware triggering circuit to sequence frame grabs. This | ||
+ | allowed me to get a camera with a C-Mount lens holder, giving me access to | ||
+ | quality and inexpensive optics, and also allowed me to vary the baseline to | ||
+ | focus accuracy on where I needed it. I created my own driver from a See3Cam fork | ||
+ | that allowed me to sync the two cameras and also dynamically reconfigure exposure | ||
+ | and sensor brightness levels. | ||
+ | |||
+ | {{:: | ||
+ | |||
+ | In the above image, the two mono cameras separated on a rail, along with a triggering circuit in the middle comprise the custom stereo camera. Two Taras are housed above looking down on the left and right corners. | ||
+ | |||
+ | {{:: | ||
+ | |||
+ | ===== ZED Camera ===== | ||
+ | |||
+ | ==== Specs ==== | ||
+ | |||
+ | **Name: | ||
+ | |||
+ | **Baseline: | ||
+ | |||
+ | The following is a sample output dump from the ZED camera. It had RGB coloring which was nice, and was accurate to near ranges, but for points further than 3 meters wavy inaccuracies formed. | ||
+ | |||
+ | {{:: | ||
+ | ==== Setup ==== | ||
+ | |||
+ | I used the ZED in Primo running Ubuntu 16.04. I used the ROS driver package | ||
+ | provided. | ||
+ | |||
+ | * OpenCV was installed already | ||
+ | * Installed cuda using the debian. Ran into an X server issue and '' | ||
+ | * Downloaded the ZED sdk run file. Made it executable and ran it. | ||
+ | * It installs in '' | ||
+ | * Ran the ZED Explorer in the tools section of the install dir | ||
+ | * Updated the firmware from 922 to 1142. After I updated i did notice some frame glitching every now and then | ||
+ | * Went to the samples and built them using CMake | ||
+ | |||
+ | ==== ROS Install ==== | ||
+ | |||
+ | * Installed the source from github as a package in the catkin_ws workspace. | ||
+ | * I changed the FPS in the launch file to 15. | ||
+ | * Also can play with the confidence level. | ||
+ | |||
+ | ==== General Notes ==== | ||
+ | |||
+ | Quality of the point cloud doesn' | ||
+ | With that said I didn't see any speckles and CPU usage is VERY low especially | ||
+ | with the lower framerates. It is a very fast little device. | ||
+ | |||
+ | ==== Software ==== | ||
+ | Found the resolution definitions here: | ||
+ | |||
+ | <code c++> | ||
+ | RESOLUTION_HD2K, | ||
+ | RESOLUTION_HD1080, | ||
+ | RESOLUTION_HD720, | ||
+ | RESOLUTION_VGA, | ||
+ | RESOLUTION_LAST | ||
+ | </ | ||
+ | |||
+ | So with 15 FPS and VGA resolution, and a level 25 confidence (which is now and | ||
+ | low) I'm still getting 120 mb/s throughput on the point cloud, which means i | ||
+ | have to fucking voxel grid filter it. I did find a '' | ||
+ | filter though. | ||
+ | |||
+ | Ok I think i just spent a half hour trying to get PCL with Cuda to build and I | ||
+ | am gonna go right ahead and give the fuck up. This will be a timesink like no | ||
+ | other. Gonna figure out what the nodelet manager is and attach a CPU based voxel | ||
+ | filter to and end of story. | ||
+ | |||
+ | ===== Filtering | ||
+ | |||
+ | Voxel grid filtering from the PCL library was used to significantly lower the data throughput on the PCLs generated by the stereo cameras. On the left image below is a raw PCL dump and on the right is a voxel grid filtered one. | ||
+ | |||
+ | {{:: | ||
+ | |||
+ |