
PRO
jsale
USA
Asked

Has anyone written a skill or script that will support the RoboClaw Packet Serial Mode communications? Specificly, a skill/script that can set the motor speed, direction, and read the encoder using the CRC16 check defined by Motion Control for use with their RoboClaw Solo 30A motor controller?
Related Hardware EZ-B IoTiny
@DJSures, I think I'm over my head with this. I might be a professional C programmer, but when it comes to C++ or C# and IDEs, I have no clue. I tried following the steps on systhiam.com to create a skill using Visual Studio, and I "think" I got the RoboClaw C# library added to the project, but I have no idea how to call the RoboClaw functions (or methods in object-oriented speak) within EZ-script. Is there any chance you could give me a few pointers on doing this? I just need to execute a half-dozen or so of the functions in the RoboClaw library to do what I want with my waist motor. I know you can't possible teach me C#, but some of the basics it getting at least one function to work would be of great help.
Sure I can give it a quick look and make a template for you. Just to clarify, you would like a dc motor to be used like a servo by having an encoder on it?
Im using the Roboclaw on my REMI robot, They also provide an app to help setup things like communication type and motor calibration. The motors I use have built in encoders and use a small pvb to route the wires proper between motor and controller. One feature on the app, is being able to calibrate motors via PIV/PID and you can then save the results. Because the Sabertooth plug-in is setup for Simple serial mode, I had decided to use of the recommended calibration methods to make sure both motors run same rpm for a "straight line" when moving forward. Its not perfect, I do se it deveate a little bit. I believe having bidirectional communication between the Roboclaw and a UART on the EZB ( and proper plug-in) would be helpful at reading the encoders in realtime and adjust the rpms to allow for a straight line when driving forard.
@DJSures, not exactly on getting a dc motor to be used like a server. More like sending the serial packet data to the Roboclaw motor controller using their CRC check. What I’m trying to do is use ARC to send Roboclaw packet serial commands (with CRC) to an ESP32 board which has its UART connected to a RoboClaw Solo30A motor controller. And since BasicMicro has a C# library with methods that execute all of their packet serial commands, it seems that it would be a nice addition to ARC to include this capability.
Unfortunately BasicMicro does not give any examples of using their C# library, nor does the code have any comments describing what the functions do. They do give examples of using their Python library, and have more documentation on it. I have sent a request to BasicMicro to see if they have some documentation or examples for their C# library, and I’m waiting for their response.
What I need (after initializing/setup of the Roboclaw object) is to be able to a call RoboClaw method from an EZB-script. If I can figure that out (with your help), I should be able to call any of the 50+ methods in the C# library to do a variety of things with a dc gear motor that has an encoder (like read the encoder value, move to a specific encoder value, reset the encoder value, and so on). Of course it won’t be as simple as that, as the Roboclaw C# library needs to be initialized, which includes internal setup of the UART.
I’m sure this is the most complicated way to do this. The other 2 ways I would think would be easier (Python code in ARC that uses Roboclaw’s Python library or use Roboclaw’s Arduino library on the ESP32), but I would think the C# library would be much more efficient in processing.
Any help I can get on this would be greatly appreciated. Maybe if I can get this to work I will try to develop an ARC skill that can access a lot of the Roboclaw controller features. Although a skill might not be the best solution since there are over 50 commands for the Roboclaw. Maybe a set of skills would be better.
It sounds like you want the dc motor to behave like a servo. So you can specify what position the dc motor will move to. I don’t see any other way to control position of a dc motor than have it behave like a servo. Your description is how a servo operates. You specify a position, and for dc motor in the servo moves the output shaft to the desired position. Using an encoder is necessary for this to happen.
so the robot skill merely needs to read the position and map it to an ARC servo. That way any robot skill could move the dc motor to specified position.
So today when I opened my C# project in Visual Studio it could not find the ARC and EZB modules. So I’ve given up for now on trying to develop using C# and building a skill.
This weekend I will try building code on the ESP32 with the BasicMicro Arduino code. If I can get that to work, then I will see what it takes to get ARC to send commands to the ESP32 to execute the Roboclaw protocol functions.
Looks like i can whip something up pretty quick to give you as a template. Are you having the roboclaw motor controller connected directly to the computer via USB? That looks ideal for the SDK. It appears the SDK prefers that. Otherwise, if you want it over serial, that can be done, too. But one or the other...
I need serial communications from ESP32 and Roboclaw as I don't have USB access in that part of the robot. Using WiFi between ARC and ESP32.