Lynxmotion SSC-32 Service Sample

The SSC32 service is a Decentralized System Service (DSS) that communicates with a Lynxmotion SSC-32 Servo Controller over a serial port connection. The service can send commands to and receive data from the controller.

This service was modified in Nov-2007 by Trevor Taylor, Software Technology, Australia.

This sample shows you how to:

Hardware and Software Prerequisites

You will also need Microsoft Internet Explorer or another conventional web browser.


Top of Page Top of Page

Start and Run the Sample

Start the Microsoft Robotics Studio Command Prompt from the Start > Programs menu.

Plug the SSC-32 Servo Controller into the serial port.

Start a DssHost node and create an instance of the service by typing the following command into the Microsoft Robotics Studio Command Prompt window:

dsshost /p:50000 /m:"ProMRDS/Config/Lynxmotion.SSC32.manifest.xml"

This starts the service and you get a response like the following:

Initializing Dss Node with manifest file: .../ProMRDS/Config/Lynxmotion.SSC32.manifest.xml 

At start up, the service automatically sends a positioning command to the controller, initializing all the servos to pulse widths of 1500 microseconds.

IMPORTANT NOTE: For use with the Lynx 6 Arm, the position of servo 2 is set to 1722 instead of 1500. This makes the upper arm start out at right-angles to the lower arm.


Top of Page Top of Page

Inspect the Service

Start Internet Explorer (IE) and type the Service URI specified in your command prompt. For example:

http://localhost:50000/ssc32

This displays the SSC32 service running on your node. You will see the current pulse widths of the servo channels 0 through 31 on a web form.


Top of Page Top of Page

Partner With the Service

NOTE:You probably will not need to use this service directly. The Lynx6Arm service does all the work for you.

Following the steps in Service Tutorial 5, you will need to add a reference to SSC32.Y2007.M01.Proxy.dll, add a partner attribute to the SSC32 service, and create an operations port to SSC32Operations.

Once you have created the SSC32 operations port, you can send commands to the controller using the SendSSC32Command operation. Currently the SSC32 service supports two commands: SSC32QueryPulseWidth and SSC32ServoMove. These commands correspond to the Query Pulse Width and Servo Move commands supported by the SSC-32 Firmware. To add more supported commands to the service, refer to the User Manual for the SSC-32 Firmware for the command formats.

The Lynx6Arm service (which can be found in the Lynxmotion/Lynx6Arm directory) provides an example of how to send messages to the SSC32 service. In the code snippet below from Lynx6Arm.cs, we create a new SSC32QueryPulseWidth command for the servos we want to query: channels 0 through 5. Then we post the message to the operations port. When we receive a SSC32PulseWidthResponse, we update the state of the Lynx6Arm using the pulse widths that we received from the SSC32 service.

    //Create new query pulse width command
    int[] channels = new int[Lynx6ArmState.NUM_JOINTS] { 0, 1, 2, 3, 4, 5 };
    ssc32.SSC32QueryPulseWidth queryCommand = new ssc32.SSC32QueryPulseWidth();
    queryCommand.Channels = channels;
    ssc32.SendSSC32Command command = new ssc32.SendSSC32Command(queryCommand);
    _ssc32Port.Post(command);
 
    //Update the arm state based on the query response
    Activate(Arbiter.Choice(command.ResponsePort,
        delegate(ssc32.SSC32ResponseType response)
        {
            ssc32.SSC32PulseWidthResponse queryResponse = (ssc32.SSC32PulseWidthResponse)response;
            for (int i = 0; i < 5; i++)
            {
                _state.Joints[i].State.Angular.DriveTargetOrientation = 
                    AngleToOrientationQuaternion(PulseWidthToAngle(queryResponse.PulseWidths[i]));
            }
            _state.GripperAngle = PulseWidthToAngle(queryResponse.PulseWidths[5]);
            resultPort.Post(new SuccessResult());
        },
        delegate(Fault fault)
        {
            resultPort.Post(new Exception(fault.Reason[0].ToString()));
        }
        ));


Top of Page Top of Page

Summary

In this sample, you were shown how to:

Top of Page Top of Page