Slow processing on Arduino
Slow processing on Arduino
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
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
- Basicmicro Support
- Posts: 1594
- Joined: Thu Feb 26, 2015 9:45 pm
Re: Slow processing on Arduino
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.
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.
Re: Slow processing on Arduino
Hi,
Did anything come from this ? Are there ways to speed up/optimise the response times ?
Did anything come from this ? Are there ways to speed up/optimise the response times ?
- Basicmicro Support
- Posts: 1594
- Joined: Thu Feb 26, 2015 9:45 pm
Re: Slow processing on Arduino
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).
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).