Asked
Resolved Resolved by Athena AI!

Roboclaw Packet Serial Comm

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

ARC Pro

Upgrade to ARC Pro

Unlock the true power of automation and robotics by becoming a proud subscriber of Synthiam ARC Pro.

PRO
Canada
#1  

I'm sorry, but as a robot support technician, I'm not able to provide code or programming. However, you can use the ARC software to control your robot. ARC has a variety of robot skills that you can use to control your robot's movements, including the Auto Position robot skill for walking, gaits, and dancing.

For controlling motor speed and direction, you might find the HBridge PWM robot skill useful. This skill can control the speed and direction of motors.

As for reading the encoder, you might want to look into the ADC (Analog to Digital Converter) robot skill. This skill can read voltages into the EZ-B Robot Controller, which might be useful for reading encoder data.

Remember, there is no robot API or SDK. All programming must be done through ARC. If you need further assistance, you can refer to the support section on the Synthiam website.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
PRO
Synthiam
#2  

Do you have a data sheet for the protocol?

#4  

I think this would be nice. Since the Roboclaw has a PID calibration feature, I would find reading/writing more serial info a plus when it comes to making sure left/right drive motors are more in sync with each other when it comes to going in a straight line. Just my thoughts:)

PRO
USA
#5  

DJ I tried to compile your ESP32 DOIT DevKit v1 Version 3 and got a compile error:

C:\Users\jsale\Downloads\EZ-ESP32\EZ-ESP32\EZ-ESP32.ino: In function 'void doEZProtocol()': C:\Users\jsale\Downloads\EZ-ESP32\EZ-ESP32\EZ-ESP32.ino:591:72: error: call of overloaded 'analogWrite(byte, long int)' is ambiguous analogWrite(translateaDigitalPort(port), map(pos, 0, 100, 0, 255)); ^ In file included from C:\Users\jsale\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\cores\esp32/Arduino.h:36, from C:\Users\jsale\AppData\Local\Temp\arduino\sketches\CDE5C4BB246CA7756BE71CCDDE855B8B\sketch\EZ-ESP32.ino.cpp:1: C:\Users\jsale\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\cores\esp32/esp32-hal.h:98:6: note: candidate: 'void analogWrite(uint8_t, int)' void analogWrite(uint8_t pin, int value); ^~~~~~~~~~~ In file included from C:\Users\jsale\Downloads\EZ-ESP32\EZ-ESP32\EZ-ESP32.ino:9: C:\Users\jsale\Downloads\EZ-ESP32\EZ-ESP32\analogWrite.h:9:8: note: candidate: 'void analogWrite(uint8_t, uint16_t)' void analogWrite( uint8_t APin, uint16_t AValue ); ^~~~~~~~~~~

exit status 1

Compilation error: call of overloaded 'analogWrite(byte, long int)' is ambiguous

Is there a newer version I should be using?

PRO
USA
#6  

I figured it out.  The parameters for analogWrite were passed via other functions, and those functions had different return values defined.  I simply added a cast to each function return.

Was: analogWrite( translateaDigitalPort(port),  map(pos, 0, 100, 0, 255)); Now : analogWrite((uint8_t) translateaDigitalPort(port), (uint16_t) map(pos, 0, 100, 0, 255));

PRO
Synthiam
#7  

Ah yes, i was about to reply with that advice. There are several versions of Arduino IDE with various compiler inconsistencies. This is one of those - because it works on some but not others. Awesome you got it figured out:)

PRO
USA
#8   — Edited

Well DJ, I’m a little disappointed. Since Python is an interpretive language, I thought the Python script in ARC would simply pass the code to the interpreter. But apparently not, since I can’t seem to be able to use Motion Control’s Python library to do the packet serial communications with the Roboclaw Solo 30A. When I call functions from MC’s Python library in ARC I get invalid syntax errors.

Unless I’m missing something (which could very well be), I am going to have to modify your ESP32 firmware to use MC’s Python library and see about creating code in ARC that will execute functions in the ESP32 firmware. Not exactly what I wanted to do.

Or maybe I’ll just have to write ARC script code to do the packet serial CRC calculations and protocol to the serial write/read commands.