Slow processing on Arduino

General discussion of using Roboclaw motor controllers
Post Reply
dave
Posts: 5
Joined: Tue Apr 12, 2016 2:33 pm
Slow processing on Arduino

Post by dave »

Hi
I'm using hardware serial ports on the mega and connecting to two Roboclaws. Using the provided library it takes around 50 to 60ms to send a simple speed or position command. I've tried baud rates upto 57600 but I don't believe it's baud rate related as it's no slower at 9600.

How can I improve the execution time of these commands? The delay this adds to the loop is making the Arduino-based PID that uses an IMU to be less than optimal. I can't understand why it is so slow as I can't measure what part of the process is causing the delay.

Thanks
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Slow processing on Arduino

Post by Basicmicro Support »

Ill need to see your code.

Also you can add some benchmarks to your arduino program(use the millis command to get the current program time in milliseconds) to see what is taking the time. Add a println before and after each command you want to time.

Make sure you have the latest firmware installed on your roboclaw. It is 4.1.16. If not please download and install IonMotion and the Windows USB drivers for Roboclaw. Then use IonMotion to update the firmware.
marcuso
Posts: 23
Joined: Sat Jun 18, 2016 2:36 pm
Re: Slow processing on Arduino

Post by marcuso »

Hi,

Did anything come from this ? Are there ways to speed up/optimise the response times ?
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Slow processing on Arduino

Post by Basicmicro Support »

I dont beleive the customer every got back to us on what was causing his problem after my suggestion on narrowing down where the problem was at.

If you are trying to reduce your response time on a particular application post what you are doing(include the code) and we'll try to help you out.

The real world tests I have done show you can get reponse times down to 1 to 3ms at 115200bps depending what commands you are executing(commands with allot of arguments obviously take longer).

Post Reply