Help with understanding position values

17 years 11 months ago #4160331 by slauziere
Help with understanding position values was created by slauziere
I have been testing and debugging on a spare motor and motor controller (3550). I am now testing with another motor controller (2550) and the positions seem to be reversed.

For instance, all the way in before stalling out a motor on the 2550 was a command of !A76 or so. On the current motor controller, I have to send it !a70 or so.

I guess the pot for feedback got reversed, but I am still a little confused.

I can adapt for either one, I was more curious for some theory behind the -127 to 127 values that the position sensor sends out.

I am curious to know why !a45 returns a position of 0xB6, whereas !A10 returns 0x10. It appears to be signed two's complement, but I feel like I am missing something that may make my life easier.

Thanks for any input.

Please Log in or Create an account to join the conversation.

17 years 10 months ago #4188943 by cosma
Replied by cosma on topic Re:Help with understanding position values
<P style="MARGIN: 0px">Commands are given using an unsigned Hex value from 0 to 7F (0-127), with the preceeding letter used to indicate the channel (a or b), and the capitalisation to indicate the sign (a=-, A=+).
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">Position values are reported as signed binary. When position is reached (ie. command = position value) !A45 should return 45, !a45 should return BB

Please Log in or Create an account to join the conversation.

17 years 10 months ago #4191014 by slauziere
Replied by slauziere on topic Re:Help with understanding position values
Thanks cosma. I understand the A vs. a, positive vs. negative. I guess my question was aiming to be more theoretical...for example, why not have values ranging from 0&lt;-&gt;255 instead of -127&lt;-&gt;+127, and then using 'A' or 'a' would not matter? Depending on application, in your current scheme, the Zero point (!A00) could be the null position of the actuator.

I wasn't sure if there was some other reason to use positive and negative position values.

Please Log in or Create an account to join the conversation.

17 years 10 months ago #4191131 by cosma
Replied by cosma on topic Re:Help with understanding position values
<P style="MARGIN: 0px">The command scheme was originally defined for the speed mode where speed and direction are two fairly independent elements of the command. In the position mode, the notion of direction doesn't make much sense and a command value of 0 to 255 would be all that maters. We decided to use the same command scheme for position and speed because it was simpler to keep it that way. I understand that it makes it a bit more complicated to manage on the host side, but the thinking was that you have plenty of extra MIPS and program space on the host to do the extra processing.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">You didn't ask but regarding the history for why we chosed Hex for commands, it is because a complete command can be sent using 4 ASCII characters, vs up to 5 that would be required to specify a decimal number (e.g. !A7F vs !A127). This requires about 20% less bandwidth and it also makes it easier on the microcontroller to convert.

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.184 seconds