To start working with Security Robot - otherwise referred to as Security-Bot or CamBot - first we want a method of communicating to the sensors or devices that will connect to the on board computer. Even though people can access the serial port and therefore the serial outputs on Arduino boards directly, I want to use the LibUSB library for three reasons: the first is so my code stays constant when working from Windows to Ubuntu, which is the OS that will be running on my Odroid. It also means I can have OS specific code settings so I do not need to worry about changing anything. Second is that I expect LibUSB will have more consistent performance than some other code. With Synchronous Device I/O abilities, I can control the rate of transfer more precisely for all devices. Third is to learn how to use this library because the library has more breathe and flexibility for programming with other USB devices.
Additionally, I am choosing to use Visual Studios 2013 because I am working on OpenCV in tandem and enjoy the debug features available in Visual Studios. Development will be programmed on Windows, in my main laptop, while the actual program will be executed in Linux Ubuntu in a later stage of development.
Downloading LibUSB Source
Currently, libusb-win32, the windows executable file on sourceforge, is a version of libusb 0.1 , which lead me to download the LibUSB 1.0 1.0.19 Source File and instead try to make the Windows Libraries.
Making MSVC Libraries from Source
Thanks to youtube account moellerIO for his tutorial in how to download LibUSB, after using 7-zip to extract the .tar.bz2 and the following .tar file to get the "libusb-1.0.19" file. In folder msvc, open your corresponding Microsoft Visual Studio Solution file. For Visual Studios 2013, it was "libusb_2013.sln" (Again, libusb-1.0.19 → msvc → libusb_2013.sln). Visual Studios opens, and find which library you want to build. To keep it simple for myself, I followed the Youtube tutorial and build libusb-1.0(static). Back in your "libusb-1.0.19" file, you should see a Win32 folder.
Similarly to the OpenCV project manager files, I will be building these libraries locally to each project.The files you should see are Win32(folder) → Debug(folder) → lib(folder) → libusb-1.0 (folder) and libusb-1.0.lib (Library). In your Debug Property Manager or Project Properties, under C/C++ → General → Addtional Include Directories, add the ... → libusb-1.0.19 → libusb folder. In Linker → General → Addtional Library Directories, add ... → libusb-1.0.19 → Win32 → Debug → lib folder. In Linker → Input → Addtional Dependencies, add the libusb-1.0.lib file.
Now your project should compile any LibUSB code. For documentation, visit the libusb documentation website for more information.
No comments:
Post a Comment