I am trying to make an AGV (Automated Guided Vehicle). I am using 2 industrial grade stepper motors (NEMA23; Model ID - 23H2100-019S) with an industrial grade motor driver (ST3986).
Since Arduino can run only single threaded processes, i.e, cannot exactly signal both the motors at the same time, and other mechanical & electrical errors, the vehicle may go off path.
If I use AccelStepper library to make the vehicle go on a linear path for a predetermined distance (say 1m) would the error be so significant that the vehicle moves away from the path and reaches some other destination?
I want to know if attaching an accelerometer to the vehicle is necessary to correct the errors. If so, are there any objects in the library to make corrections?
I tried searching online for similar example even with smaller motors and drivers, but I wasn't able to find any.
You should study the AccelStepper library some more. You can tell 2 (or 3 or 4 or more) motors to go a number of steps and as long as you call the run() function often enough the motors will move there while you do other stuff.
Use the MultStepper class to make the motors do coordinated movements.
I have tested the Multistepper class, though not on ground with wheels attached. But, even that is not a multithreaded process... there will be a difference in when signals reach both the motors...
It detects acceleration not movement . If the movement is at a constant speed then there is no acceleration.
The data from an accelerometer is too noisy and will drift. You are mistaken if you thing people use this for correcting robots, they don’t.
You need to use an rotary encoder attached to the motor’s to measure that the required number of steps has been mage by each motor. But the wheels could slip on the floor maki g this not work.
After calibration, you might be able to use a magnetic compass (magnetometer) or a rate gyroscope to keep your robot pointed in the desired direction. Neither will do anything for measuring distance traveled. For that, your best bet might be to count steps to the wheels. That assumes the wheels never slip.
I have not written the code yet. I have only tried the example programs, manipulating the configuration. It's an industrial prototype project, and they also need to construct the body. But I will update as soon as I am able to try it out with wheels attached. Thanks!