Compiling for .NET use

Added by Pablo Aizpiri over 5 years ago


I bought pixycam a while ago and I'm hoping to able to interface with camera over USB using C#.

I saw the was a pixy usb library- I tried building PixyMon, but after a couple frustrating hours, I can't seem to get anywhere or properly build PixyMon. (When I did, I kept getting an error) This is likely because using QT is new to me and I don't develop in C++ other than very small applications.

Is there an easy way for me to compile the pixy usb library so that I can call it from C#? What's the least path of resistance for me to be able to use pixy with C# over USB?

Replies (6)

RE: Compiling for .NET use - Added by Pablo Aizpiri over 5 years ago

So after spending another 6 hours :)

I think I finally got it. I was able to compile the lib USB and pixyusb using QT and boost. I then added some extern attributes for the calls I wanted to make from my library, and then wrote a C# .NET wrapper around it. (I know, I'm a n00b)

I'm almost done, and I'm very pleased. Right now I'm looking to get a cable that is shorter/will transmit more power because my servos are having a hard time getting enough power.

Also, I didn't see much documentation on what commands I could send over the pixy_command() method. I would be interested in that if anyone can point me in the right direction.

Anyway, very happy now; just waiting for my cables and eager to implement the rest of the pixy library functionality for my .NET wrapper class- but I was able already able to write a little console application to display the block data, get version information, and set the LED color. :)

RE: Compiling for .NET use - Added by Edward Getz over 5 years ago

Hello Pablo,
Sounds like you've made good progress :) I don't know of anyone who has tackled libpixyusb for .net, although we tried to make sure there were no huge obstacles (unavailable libraries, etc). We'd love to know what your plans are and what platform you are using. :)

Also -- What problems did you have when compiling PixyMon? I'm a little confused why you are using Qt with libpixyusb and .net. Libpixyusb doesn't require Qt.

Documentation for the available commands is mostly available through the command prompt on PixyMon. Just hit the pause button and type "help" into the command window. You can then type "help cam_getFrame" to get help for cam_getFrame or any other command you're interested in. This is probably the easiest way to see what's available. These descriptions are embedded in the firmware.

Hope this helps!


RE: Compiling for .NET use - Added by Pablo Aizpiri over 5 years ago

Hey Edward,

Thanks for your response!

Does my ignorance show? Hehe. I realize I don't need QT for compiling specifically the pixyusb and libusb projects, but being a beginner to C++ and the build systems, I just wanted the whole repository to JUST build, and so I needed that for pixymon... once I had that, I felt confident enough to start taking it apart. I was going one step at a time. :)

For sure, the main obstacles here were my leaning curb- you guys certainly seemed to provide all the tools necessary. (Thank you!)

I'm not sure yet what project I will be using it for yet, but I'm enjoying being able to play around with it using .NET on Windows :)

I will try to finish up the code and put it on GitHub, and maybe make a guide for developers with a .NET background so they can use it as well; maybe the community can make use of it?

RE: Compiling for .NET use - Added by Edward Getz over 5 years ago

Hello Pablo,
For sure! I think lots of people will appreciate your .NET findings!

Thanks so much!


RE: Compiling for .NET use - Added by Pablo Aizpiri about 5 years ago

Hello Edward,

Since I last posted I worked some more on the library- it's still a work in progress but I've had someone reach out to me after finding this post on Google, so I figured I'd put up what I have on GitHub:

I also wrote a quick blog post on it:

Hope others can get some value out of it. Thanks again for all the work with PixyCam!

RE: Compiling for .NET use - Added by Edward Getz about 5 years ago

Hi Pablo,
Thanks so much! We went ahead and posted to Twitter and Facebook. :)