Waiting for buffer/motors to arrive at destination
Posted: Wed Aug 17, 2016 11:04 am
Hi, When I tell the roboclaw to move the 2 motors to a position, what's the best way to find out when they arrive there. To read the encoder values and see if they match up to what I sent them to, or to read the buffer? If I read the buffer and it's empty, does that mean they have successfully completed the positions I sent to them? If so, then that sounds like an easy way to tell my machine it's ready to execute the next step.
thanks.
ps. Will this work?
thanks.
ps. Will this work?
Code: Select all
roboclaw.SpeedAccelDeccelPositionM1(address, accel, maxSpeed, deccel, M1val, 0); //
roboclaw.SpeedAccelDeccelPositionM2(address, accel, maxSpeed, deccel, M2val, 0); //
uint8_t depth1; //buffer 1 reading
uint8_t depth2; //buffer 2 reading
while (depth1 != 0x80 && depth2 != 0x80) { //wait for buffers to be empty
roboclaw.ReadBuffers(address, depth1, depth2);
delay(100);
} //end of waiting for drillhead position