« Design Review | Main | Painting on plastic »
March 05, 2007
Octopart, and "It Just Works"
Today I learned of a website called "Octopart," which is a search engine designed around locating electrical and mechanical parts. This probably would have saved me hours during the Blimpbot component search. For instance, I previously spent at least 30 minutes finding somewhere to buy our main microcontroller, because it was relatively new and not available at all the sellers. Instead, you can find the product and its availability across all of the major sites in, say, 0.005 seconds, according to the Octopart server. Pretty cool.
On another note, for software developers in particular, I have been impressed by the "It Just Works" (IJW) C++ unmanaged / C++ managed interoperability in Visual Studio 2005. Read on if interested. IJW is the name given to the ability to let unmanaged code access managed objects, and to let managed code seamlessly instantiate and call unmanaged objects. The upshot of this is that you can avoid expensive copy operations when passing data between the two realms. This is special to Visual C++, you can't do it with Visual C# or any of the other managed languages.
For the Blimpbots project, we're using a little bit of this to call several unmanaged libraries, including Intel OpenCV, and the SURF keypoint detector. For starters, you can mark any unmanaged code blocks with a #pragma unmanaged directive. Then, within managed C++, you just call the unmanaged libraries as you normally would, as long as you're passing value types. If you want to pass arrays or reference types, you first use a special pin_ptr syntax to tell the garbage collector not to mess with some block of memory temporarily, and then you just call the unmanaged code and pass the pointer. I'm actually not quite sure how this is accomplished behind the scenes, but, it just works, and has been quite helpful!
Posted by jrpowers at March 5, 2007 07:29 PM