Controlling roboclaws from a C++ Application

General discussion of using Roboclaw motor controllers
Post Reply
bmat
Posts: 7
Joined: Tue Nov 27, 2018 7:10 am
Controlling roboclaws from a C++ Application

Post by bmat »

Hello,

I am trying to control two 2x60A roboclaws in packet serial (direct USB connection to PC) through a C++ application (specifically, a Qt C++ application). The libraries provided for roboclaw are in C# and Python. I have spent some time reading up how to use a C# .dll in C++ (COM interop) but it seems like those solutions either wont work in Qt or I'm not smart enough to understand how to make them work. I also tried to find C++ roboclaw libraries to no avail.

My questions:
1. Are there any available C++ roboclaw libraries out there?
2. Has anyone had experience using C# .dll or Python classes within C++ (maybe even within Qt)?
3. Would anyone have any tips to point me in the right direction for using C# .dll or Python classes within C++?

It might be worth to mention that the end product of this project should be platform independent (windows/MAC) but getting it started in windows is still great.

Thanks!
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Controlling roboclaws from a C++ Application

Post by Basicmicro Support »

1. The arduino library is C++ effectively.

2. The reason we havent dont a C++ library specifically for Windows is because there is no standard serial port class for C++(C# has a standard serial port class which is why we used it on the PC).

I recommend looking at the arduino library as a start. It was written to be as universal as possible. There are only a few places that are arduino specific(eg serial port access code). You should be able to take the majority of the code, replace the serial port code with whatever serial port library you decide to use(PC and/or Mac) and have it up and running fairly quickly. I assume if you are use QT you have a decent understanding of C++ in general.

We use QT ourselves but only for mobile applications so my desktop experience in QT is limited. But if you have questions you can try asking me. I may be able to help(or not) when it comes to desktop QT.
bmat
Posts: 7
Joined: Tue Nov 27, 2018 7:10 am
Re: Controlling roboclaws from a C++ Application

Post by bmat »

Wow, thank you for your reply! I never thought about trying to work with the arduino library and just replace the serial communication methods with options that are windows/osx compatible. I will definitely let you know my progress and if I have any questions!

Thanks!

Post Reply