# LSS : what reference for MOVE?

Hi all,

The beginner is at it again…
I am trying to figure out how to properly use the [M]D commands.
I am not managing.

I do not understand (and it not explained) how it works.
What is the reference point ?
When you power on the system after you have moved the servos randomly, how do you know where (what angle) it is standing at ?
And then, how do you move to a given angle ?

What is the standard way to do it ?

Thanks

Dpi

Hello @dpi!

As the documentation says:

The relative move command (MD) causes the servo to read its current position and move the specified number of tenths of degrees in the corresponding position.

This means that the “reference” point is the angle at which the servo is located at the moment you send the MD command. If you want to know which is that angle simply send a Query Position in Degrees (QD ) command before the MD command.

However, it seems to me that what you want is not a “relative” move but an “absolute” move, you can do that by using the Position in Degrees (D ) command, which:

Moves the servo to a specific angle, where the center (0) position is centered (this is the origin or “factory zero” position, which could be changed using the Origin Offset (O) command).

2 Likes

We’re here to help.

It is a relative move from the servo’s current position in tenths of degrees.

Q1) What is the reference point ?

A1) The servo reads its current angular position as soon as the command is received and uses that as the reference. For example if the servo is holding at 60 degrees and you send a relative move command of -25, the servo will move to 35 degrees (60-25).

Q2) When you power on the system after you have moved the servos randomly, how do you know where (what angle) it is standing at ?

A2) The servo has a built-in angular sensor capable of reading all 360 degrees. However, it does not know if the last position was beyond 360 degrees (or -180 to +180 degrees) as it does not store the multi-turn value.

Q3) And then, how do you move to a given angle ?

A3) The servo is fully configurable (so you can move the zero if you want). Assuming you did not move the zervo and want to move to a specific angle, you would use the Degree command, which is in tenths of degrees.

For example:

1. Servo is not powered
2. The horn is rotated
3. The servo is powered on, and it reads the angle of the output horn with respect to the zero to get the 360 degree angle. This can be 33.2 degrees for example.
4. You can then send a position command to move to a desired position (for example 47.1 degrees) using the D command (again, note that it’s in tenths of degrees):
`#0D471<cr>`

Alternatively, at step 3. you can query the servo’s actual angle using the QD command, which will reply with D332 for 33.2 degrees, then do a relative move of 13.9 degrees which has it rotate to 47.1 degrees (33.2 + 13.9 = 47.1)

The MD command can be useful if you want to repeatedly increment the angle. For example starting at 0, sending one MD300 command will have it rotate to 30.0 degrees. Sending the same command will have it move to 60.0 degrees… then 90.0 and so on.

1 Like

Thank you Geraldine !

‘O’ is what I was looking for.

I did not know about it because… it is missing - completely - in the LSS Communication Protocol document !
It would be a very good idea to add it there.

The ‘MD’ commands do work, but in my case I would rather use absolute values (in the code).

The ‘D’ command (without ‘O’) acts strangely.
Here is an example from the last test I did, that is still on my screen.
A thread collects the ‘QD’ value and display it as it goes when it changes (<-)
The main thread sends the commands (->)

• Turn on power.
← QD1749
→ D1300
← QD1639
← …
← QD1411
← QD1300
← QD1166
← …

… and it goes on until it blocks !
I cannot understand what is going on there. Any idea ?

Sending ‘O’ at the beginning, it works ! (and it is 0 based from where I positioned it).
So I don’t need an answer to the question any more but I still wonder why ???

1 Like

Note that the Origin Offset (‘O’) command changes the origin during that session, while the CO command changes the offset in EEPROM (and normally only needs to be done once in a setup). Not many situations would require constantly updating the origin of a servo.

From what you wrote, you send a position command and monitor it during the move, only to see that it goes beyond 1300. Is the servo subjected to an external torque which might cause it to go beyond the desired position? What happens after 1166?

The D command is the most “basic” one used to position the servo, so if you can provide the code, additional information about the setup etc. it might help us diagnose. The issue may be related to changing the origin.

1 Like

Hi,

In the version of the document I downloaded (attached so you can check), the ‘O’ command appears (I found it now that I know it exists) in the ‘Command List’ section, but not in the ‘Details’ section !
LSS - Communication Protocol - XWiki.pdf (390.3 KB)

Of course I only looked at the Details section…

As for the original problem:

There is no external torque applied to the servo, and, after 1166, it keeps going down until 736 where it stops because the movement is blocked by a part of the frame (and it goes flashing red).

I have not kept the code as it was back then. I switched to relative move (MD) but it was inconvenient in my case.

At the time, I was also experimenting with the Gyre commands (G, CG) and I had started to suspect that it might have something to do with that.

But the O is what was missing (it HAD to exist) and I have no need (nor time) to re-test without it.

Please make sure it is, and stays, in the Details section for future beginners.

And thanks everyone for the impressive reactivity !

1 Like

Weird - in the document you linked to, it jumps from page 17 to 19, and Origin Offset (detail) is on page 18. Just tried the Export feature of the Wiki to be sure and can see the Origin Offset command under Details. Also tried printing the section to PDF and see Origin Offset. Honestly don’t know why it doesn’t appear in yours.

Happy it’s working now.