Position Control values

Questions about using encoders with the Roboclaw product line
Post Reply
SouthernAtHeart
Posts: 32
Joined: Fri Jan 29, 2016 4:00 pm
Position Control values

Post by SouthernAtHeart »

The data sheet says:
41 - Buffered M1 Drive With Signed Speed And Distance
Drive M1 with a signed speed and distance value. The sign indicates which direction the motor will run. The distance value is not signed. This command is buffered. This command is used to control the top speed and total distance traveled by the motor. Each motor channel M1 and M2 have separate buffers. This command will execute immediately if no other command for that channel is executing, otherwise the command will be buffered in the order it was sent. Any buffered or executing command can be stopped when a new command is issued by setting the Buffer argument. All values used are in quad pulses per second.
Send: [Address, 41, Speed(4 Bytes), Distance(4 Bytes), Buffer, CRC(2 bytes)] Receive: [0xFF]
All values used are in quad pulses per second -- that is a unit of speed. So the speed value is given in QPPS.
What about the Distance value, what is it exactly? The encoder count value? If I read the encoder value, and it's 10,000,000, what will happen if I send a distance value of 1,000,000? Will it move backward to the spot where the encoder value is 1,000,000, or will it move 1,000,000 pulses from it's current position, depending on the sign of the speed value?

I just don't want to send it any commands before I know exactly what it's going to do. Thanks.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Position Control values

Post by Basicmicro Support »

Distance is in encoder counts(pulses)
Speed is in encoder counts per seconds(pulses per second).

Distance commands are incremental. If you give a distance of 1000000 it will move from the current location for 1000000 encoder counts at the speed specified(forward or backward depending on the sign of the speed argument).

The position commands are absolute. The move to the specific position specified at the (unsgiedn) speed, whichever direction that needs to be to get to that position(but requires the Position PID settings to be tuned).
SouthernAtHeart
Posts: 32
Joined: Fri Jan 29, 2016 4:00 pm
Re: Position Control values

Post by SouthernAtHeart »

Thanks, that's starting to clear things up. I'm kind of lost here on the position thing, but I'm guessing there's a typo in the data sheet. I don't see anything in the data sheet that falls under position control. Are commands 66 & 67 position commands? The data sheet I have says 'signed speed'
65 - Buffered Drive M1 with signed Speed, Accel, Deccel and Position
Move M1 position from the current position to the speci ed new position and hold the new position. Accel sets the acceleration value and deccel the decceleration value. QSpeed sets the speed in quadrature pulses the motor will run at after acceleration and before decceleration.
Send: [Address, 65, Accel(4 bytes), Speed(4 Bytes), Deccel(4 bytes), Position(4 Bytes), Buffer, CRC(2 bytes)]
Receive: [0xFF]
Can you tell we which commands are for position control? Thanks.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Position Control values

Post by Basicmicro Support »

Yes, 65.66 and 67 are the position commands. Note there is a typo in the names, The speed value should say "unsigned", not "signed".

To use these commands you have to tune the Position PID settings, set the min and max position values and set the QPPS setting. Other Velocity PID settings are optional.
SouthernAtHeart
Posts: 32
Joined: Fri Jan 29, 2016 4:00 pm
Re: Position Control values

Post by SouthernAtHeart »

Great! This sounds exactly like what I need. It's a high quality motor, so I should be able to position tune it pretty well.

Post Reply