Hello Support and others,
I created a library for the Roboclaw 2x30A a year ago.
Now I wanted to use this library for the new Roboclaw 2x60 version.
In the first view everything looks good, but then I realized, that my library only returned positive speed values.
In the RoboClaw 2x30A version you get 6 bytes back if you use command 18 or 19. 4 bytes are for the actual PPS (pulse per second) and the 5th byte is for the direction it can be 0 or 1, the 6th is the checksum.
I build the ppsValue which includes the actual pulsePerSeconds like this:
Code:
ppsValue = (int)pBuffer[3]; // pBuffer contains the received data from the roboclaw
ppsValue += (int)pBuffer[2] << 8;
ppsValue += (int)pBuffer[1] << 16;
ppsValue += (int)pBuffer[0] << 24;
direction = pBuffer[4];
To use the direction information i can calculate something like this:
Code:
if(direction == 1)
actualSpeedValue1 = ppsValue1 * -1;
else
actualSpeedValue1 = ppsValue1 ;
This worked in the 2x30 version without any problems! but I realized, that in the 2x60 version you already get a inverted speed value directly from the Roboclaw.
But in the User Manual it is not described that you get
negative values you say you will get only positive values :
Quote:
The command will return 6 bytes. Byte 1,2,3 and 4 make up a long variable which is received
MSB first and is the current ticks per second which can be any value from 0 - 4,294,967,295.
Byte 5 is the direction (0 – forward, 1 - backward). Byte 6 is the checksum.
what I can confirm for the Roboclaw 2x30 version.
But not for the 2x60 version!So please actualize the User Manual and make a notification that these commands have been changed and that they will work different in different Roboclaw versions.
Best regards,
Thomas