LSS Smart Servo : Read Position and Not Unwinding to go to zero position

I have a LSS Smart Servo Standard - ST1.

  1. Can you read the current position and/or if it is “In Position” or Stopped?
  2. If I have been sending it an increasing angle to move to, then stop it. When I send it the command to move to “0” angle it unwinds by numerous revolutions back to 0 degrees. Can this be made to just go to “0” without unwinding?

Thanks…

1 Like

Hi DrSutherland,

  1. It’s possible to query the position in any status which include While it’s moving and Stopped.
  2. The servo is multi-turn so the Zero could be far away. If it “unwind” that means you have move more than one turn.

Let us know,

:slight_smile:

1 Like
  1. Can you give me a hint on the command to read the current position?
  2. Is there a command to reset the servo and whatever position its in is now “0” i.e. If it turned 4000 degrees (10 plus revolutions), can it reset it, then move to to the position I want to be home and then set that as home?
1 Like

Hi DrSutherland,

Of course I can help.

  1. The proper command would be “#1QD” and would reply the position. More about it HERE.
  2. If that’s what you want yes it’s possible. There are a couple of ways to do that or similar but usually the code that’s handling the servo will count and know where it wants to start stop and where it is.

To set a new “zero” or “Origin Offset” you can either Configure it as something that will be recorded for the next power cycle or not.
When there is a “C” in the command it will be configured and stored but without it will be used until rebooted.

#1O” to set the Origin Offset to the current position until reboot
#1CO” to configure it and take effect also on reboot.

Origin Offset on the wiki

All the best,

2 Likes

I don’t seem to be resetting the angle to “0” using the “#0O” command. I can move it to a relative home position (it doesn’t unwind when I send it a #0D0" command) but when I read the angle again with the “#0QD” command I get the total angle that it has moved, it doesn’t reset to “0” counts after I send it the “#0O” command.
Here is my code for moving the servo 1 degree (relative to current position) and plotting the angle vs index
Thanks…Tom

function [] = testLSS()

if(exist('serialCOMLSS','var') == 1)
    disp("Serial COMM Port Already Open");
else
    try
        serialCOMLSS = serialport("COM12",921600);
        configureTerminator(serialCOMLSS,"CR");
    catch
        disp("Did not open Serial COMM Port")
    end
end

%Move Servo To Zero Position (Does not unwrap)
%Poll and Read Angle from Servo.
writeline(serialCOMLSS,"#0QD"),str = readline(serialCOMLSS);
strs = strsplit(str,"D");       %  ["*0QD"   "769915"]
angstr = strs(2);
ang = mod(str2double(angstr),3600); %Get distance to "Relative Home"
str = strcat("#0MD-",int2str(ang)); %Generate command string to move to home.
writeline(serialCOMLSS,str);
pause(3);

writeline(serialCOMLSS,"#0O");  %Set temporary origin to this position.


ButtonHandle = uicontrol('Style', 'PushButton', ...
                         'String', 'Stop loop', ...
                         'Callback', 'delete(gcbf)');

angchangeTolerance = 1;

diff = 2*angchangeTolerance;

ind = 0;
while(1)


    %Poll and Read Angle from Servo.
    writeline(serialCOMLSS,"#0QD"),str = readline(serialCOMLSS);
    strs = strsplit(str,"D");       %  ["*0QD"   "769915"]
    angold = str2double(strs(2))

    writeline(serialCOMLSS,"#0MD10"); %Move Servo 1 degree relative.
    %writeline(serialCOMLSS,"#0MD100"); %Move Servo 10 degree relative.

   % Wait for the move to be completed before reading and plotting
    while diff > angchangeTolerance
        %Read Angle from Servo.
        writeline(serialCOMLSS,"#0QD"),str = readline(serialCOMLSS);
        strs = strsplit(str,"D");       %  ["*0QD"   "769915"]
        angstr = strs(2);
        ang = str2double(angstr)
        diff = abs(ang - angold);
        angold = ang;
    end

    %Read Angle from Servo.
    writeline(serialCOMLSS,"#0QD"),str = readline(serialCOMLSS);
    strs = strsplit(str,"D");       %  ["*0QD"   "769915"]
    angstr = strs(2);

    hold on, plot(ind,str2double(angstr)/10.0,'k.'), drawnow
    
    ind  = ind + 1;

    if ~ishandle(ButtonHandle)
     disp('Loop stopped by user');
     serialCOMLSS = [];
     break;
    end 

  end

end

%end

The command to set the offset is “CO” or just “O” if you don’t want the value to be saved after next reboot.
Here is a quick video showing the command sent by the LSS-Config.