Command 54 - M1/M2 Duty & Acceleration
Posted: Tue Aug 07, 2018 8:15 am
Hello,
I am using a Roboclaw + motors without encoders. Over USB. Raspberry Pi. C++. I treat both motors together (it's a tracked robot, for turning I just want to pivot, so duty cycle is always the same amplitude just different sign (?)).
Been using someone else' code. I believe it's currently command 34. For ramping, it seems to be just keeping track of previously sent duty cycle, and slicing/dividing up the range between previous and currently desired duty cycle, and just sending new duty-cycle commands for each slice until the desired duty is reached.
I was thinking to replace all that with command 54.
Q: is that the command I should use? If so,
Q: I think I understand the duty-cycle part of the command. Wanted to clarify the acceleration values. Trying to relate the 0 to 655359 to the -100% to 100% ( I actually dont plan to use 0-100% values in my program - dont mind directly manipulating the real values)
I do best with concrete examples.
say the motors were at -32767 and I wanted to ramp to zero as quickly as possible. Would the acceleration be 655359? Does that mean it goes from -32767 to 0 in 100ms?
or this one: (I might always stop in between, but maybe not): what if motors were at -32767 and I wanted them to go to 32767 as quickly as possible. First, is that possible? and if so what would be the acceleration value.
thanks
I am using a Roboclaw + motors without encoders. Over USB. Raspberry Pi. C++. I treat both motors together (it's a tracked robot, for turning I just want to pivot, so duty cycle is always the same amplitude just different sign (?)).
Been using someone else' code. I believe it's currently command 34. For ramping, it seems to be just keeping track of previously sent duty cycle, and slicing/dividing up the range between previous and currently desired duty cycle, and just sending new duty-cycle commands for each slice until the desired duty is reached.
I was thinking to replace all that with command 54.
Q: is that the command I should use? If so,
Q: I think I understand the duty-cycle part of the command. Wanted to clarify the acceleration values. Trying to relate the 0 to 655359 to the -100% to 100% ( I actually dont plan to use 0-100% values in my program - dont mind directly manipulating the real values)
I do best with concrete examples.
say the motors were at -32767 and I wanted to ramp to zero as quickly as possible. Would the acceleration be 655359? Does that mean it goes from -32767 to 0 in 100ms?
or this one: (I might always stop in between, but maybe not): what if motors were at -32767 and I wanted them to go to 32767 as quickly as possible. First, is that possible? and if so what would be the acceleration value.
thanks