seedstpprotocol:control_using_stp

This is an old revision of the document!


All Seed Robotics products can be controlled using the Seed Robotics STP Protocol and they also have full support for the Dynamixel Protocol (versions 1 and 2).

On this document we will focus of the STP protocol which is a simpler, lighter and easy to use approach to controlling the units.

The main advantage of the STP protocol is that you can quickly send commands to the unit and query status information using a direct Serial Connection and text commands.

When operating through the USB Connector, the unit creates a Virtual serial port on the host computer, to which you can connect at any Baud rate, up to 10Mbps.

When operating via Bluetooth (if installed), the unit uses the Bluetooth Serial Port Profile (SPP) to create a Virtual COMM port on the target device.
The Bluetooth interface can be used wirelessly with your computer and also your smartphone.

The protocol is pretty simple and straightforward and is built on the following foundations:

  • Each device connected to the bus, has a unique ID and behaves as a “slave”. The main board has also got its own ID to allow access to its functionalities.
  • Slaves are always silent and will only respond when queried by the master (host)
  • The slaves expose a Control Table, a kind of memory map, where the master can read status variables or write data to trigger actions.
  • The master addresses the slaves by their unique ID and using specific command sot either READ or WRITE data.
  • Every time the master sends a READ or WRITE command to a slave, the slave acknowledges the command by sending a reply packet.
  • All commands sent by the host must be terminated by a \n
  • All values returned by the slave are enclosed in square brackets [ ]
  • The protocol does not have any checksum or error correction features. We assume the communication is reliable and if necessary, the communications stack (USB or Bluetooth) take care of error correction.

The description of the Control Table memory positions is available for each device:

By default, the STP protocol is available over the USB and Bluetooth interfaces (Bluetooth may not be available if it is was not requested as an option).

To connect via USB:

  • Remove the cover of the unit to reveal the micro USB connector
  • Connect one end of a micro USB cable to the hand and the other end to the host computer. This will create a Virtual COMM port on the host.
  • Using a Serial Terminal (such as Putty or any other), connect to the Virtual Serial port. You can select any speed up to 10Mbps.
  • VERY IMPORTANT: Configure your Serial Terminal to use \n as the line terminator or the unit will not properly recognize the commands.

To connect via Bluetooth (if installed in your unit):

  • If using a portable device, scan for a device named SEED_[S/N] (where [S/N] would be your unit's serial number)
  • If using your computer, open the Bluetooth software and scan for the same SEED_[S/N] device. Once connected the PC will create a Virtual COMM port that connects to the unit.
  • Using a Serial Terminal (such as Putty if using your PC or any other compatible with your platform), connect to the Virtual Serial port. The Bluetooth connection operates at 115200bps.
  • VERY IMPORTANT: Configure your Serial Terminal to use \n as the line terminator or the unit will not properly recognize the commands.

Once you're connected, you're ready to start typing your commands.

Unlike the Dynamixel protocol, in the STP protocol, we have a clear distinction if we want to read/write a byte or a word (2 bytes). If you examine the Control tables, there is a column named “Size” which indicates the number of bytes for that parameter. Size=1 means a byte, Size=2 means a word (2 bytes)

We recommend that you take time to examine the Control Tables to familiarize with the parameters that are BYTE or WORD.

To read and write to the control table, 4 commands are made available: reb and wrb to read and write a byte and rew and wrw to read and write a word. For the complete syntax, see the Console commands for your unit:

As an example, to move an Actuator with ID 2 to position 256, you would send the following commands:

Firstly we must set the Torque on, so we write the value 1 to memory position 24 (this is a Byte value):

wrb 2 24 1

Next, we write the desired Goal position (int his case 256). The goal position parameter is at Memory Position 30 and is a Word (2 byte value)

wrw 2 30 256

After sending each command, the slave acknowledges the command and replies with a status byte enclosed in brackets [ ]. This status byte is the Error bitmask and contains valuable information about the status of your servo.

As an example, to read the current Temperature of an Actuator with ID 4, you would send to the bus:

reb 4 43

When the slave receives the command it will return the value requested enclosed in brackets [ ] followed by the error bitmask also enclosed in brackets.

After sending a command, a return byte is always sent, enclosed in [ ]. The return byte is a bitmask that contains the status of the servo. Data is returned as a decimal number that, once converted to binary can be interpreted as follows:

  • Bit 7: always 0
  • Bit 6: reserved
  • Bit 5: Overload Error. The slave has detected an excessive external force (outside the specification) and has turned torque off to protect from further damage.
  • Bit 4: reserved
  • Bit 3: Range Error. Occurs when you try to write a value that is outside the allowed scope for that setting.
  • Bit 2: Overheating Error. The servo is exceeding the set temperature for safe operation. Shutdown the servo and wait for it to cool.
  • Bit 1: Angle error
  • Bit 0: Input Voltage Error

IMPORTANT: in the RH2D, using the Robotis XL-320 actuators, the error bitmask is different from the above. Please refer to the RH2D documentation and Control table for the XL-320 actuators for more information.

  • I get no reply when I send a command: you must terminate your commands with a \n. If you are using a Serial Terminal make sure it set to use \n as a line terminator.
  • Sometimes I get text instead of a number in the square brackets [ ]: this happens when there is a severe error that can be reported in the error mask. For example a timeout would return the textual “timeout” message.

The STP Protocol is as simple as it gets. It respects the Memory Mapped design of the actuators and provides an easy to use protocol to interface with the units.

The fact that all replies come enclosed in brackets [ ] makes it easy to parse when building your own program.

Copyright © 2015-2023 Seed Robotics Ltd

  • seedstpprotocol/control_using_stp.1504728727.txt.gz
  • Last modified: 2017/09/06 20:12
  • by Pedro Ramilo