Primitive DLL to talk to Maestro

Howdy Forum,

I’m interested in creating a primitive Win32 DLL to communicate with the Maestro servo controllers over USB. Something similar to what DavidEGrayson was discussing here:
https://forum.pololu.com/t/driving-the-maestro-via-usb-by-calling-driver-dlls-how/3978/6 Does something like this currently exist?

I’m using Microsoft Visual Studio 2012. Are the existing UsbWrapper/etc.dlls compatible with this version of .NET (4.5)?

Thanks!
Jim

Hello, Jim.

No, unfortunately we do not yet have a Win32 DLL to talk to the Maestro. I think that the people who would benefit from that DLL are mostly just using the Maestro’s virtual COM port, but still it would be nice to have the DLL. If you make this DLL, it would be cool if it supported SWIG or something similar.

As far as I know, the existing DLLs in the Pololu USB SDK are compatible with .NET 4.5. They were made with Visual Studio 2008 and target .NET 3.5, but I think you can use from a later version of .NET. Let me know if you have trouble using them.

–David

Howdy David,

Are the latest UsbWrapper and Usc DLLs compiled for 64 or 32 bit? I’m currently using MSVS 2012, and we are compiling for 64 bit MATLAB.

Our end goal is a DLL to be used by MATLAB. I’m able to import a DLL created from C# in MATLAB (via NET.addAssembly) . However, when I add the devices method to my class:

using System;
using Pololu.Usc;
using Pololu.UsbWrapper;

namespace TestCSdll
{
    public class MyClass
    {
        public static double add(double x, double y)
        {
            return x + y;
        }

        public static string devices()
        {
            var device_list = Usc.getConnectedDevices();
            if (device_list.Count > 0)
            {
                return device_list[0].serialNumber;
            }
            else
            {
                return "blah";
            }
        }
    }
}

and try to invoke in MATLAB, I get this response:

>> TestCSdll.MyClass.devices()
Message: Could not load file or assembly 'UsbWrapper, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null'
or one of its dependencies. The system cannot find the file specified.
Source: TestCSdll
HelpLink:

Any thoughts?
Jim

Well, I discovered the issue here. I was referencing the DLL in obj/Release, not bin/Release. Builds fine thus far.

Jim