Skip to main content

Schunk Motion Protocol for Python 3

Project description

Schunk Motion Protocol manual:


This is not a commercial product and the author has no relation whatsoever to SCHUNK GmbH & Co. KG.

Use at your own risk!


Only 1 device was tested: Schunk PR-70 Servo Electric Swivel Unit.

Defaults for this device: RS232, baudrate=9600, module ID 11 (0x0B).

Other devices may or may not work.


Python version 3.x is required.

Typically, PySerial handles the serial connection, but any library with a similar API can be used.

py.test is used for the tests.


Only a subset of the Schunk Motion Protocol is supported.

Only the direct response to a command can be obtained, impulse messages are not supported. One exception is the “CMD POS REACHED” impulse message which is used to realize movement commands which are waiting until the movement is finished, e.g. move_pos_blocking().

Only floating point unit systems are supported.

The connection is opened and closed for each message. Keeping the connection open is not supported.

Only the RS232 protocol is implemented.


Using pip, you can download and install the latest release with a single command:

pip3 install --user SchunkMotionProtocol

If you want to install it system-wide for all users (assuming you have the necessary rights), you can just drop the --user option.

If you have only Python 3 installed on your system, you probably have to use pip instead of pip3.

To un-install, use:

pip3 uninstall SchunkMotionProtocol

If you prefer, you can also download the package from PyPI, extract it, change to the main directory and install it using:

python3 install --user

If you have only Python 3 installed on your system, you probably have to use python instead of python3.

If you want to get the newest development version from Github:

git clone
cd schunk
python3 install --user

Alternatively, you can just copy to your working directory.

If you want to make changes to the code, you should type:

python3 develop --user

or, alternatively:

pip3 install --user -e .

… where -e stands for --editable.


Tests are implemented using py.test, run this in the main directory:

python3 test


This should get you started:

import schunk
import serial

mod = schunk.Module(schunk.RS232Connection(
    0x0B, serial.Serial, port=0, baudrate=9600, timeout=1))


Use the ID of your Schunk module instead of 0x0B.

See the documentation of PySerial for all possible serial port options. You probably only have to change port, e.g. port='/dev/ttyS1' or port='COM3'.

It is useful to specify a timeout, otherwise you may have to wait forever for the functions to return if there is an error. On the other hand, if you want to use the blocking commands (*_blocking()), you should disable the timeout (or make it longer than the expected movement times).

If the parameters for your setup don’t change, you can write them into a separate file, e.g. with the name

import schunk
import serial

module1 = schunk.Module(schunk.RS232Connection(
    0x0B, serial.Serial, port=0, baudrate=9600, timeout=1))

and then use it like this in all our scripts:

from myschunk import module1

The file must be in the current directory for this to work.

If you are an object oriented kind of person, you can of course also write your own class:

import schunk
import serial

class MySchunkModule(schunk.Module):
    def __init__(self):
            0x0B, serial.Serial, port=0, baudrate=9600, timeout=1))

module1 = MySchunkModule()

Project details

Release history Release notifications

History Node


History Node


History Node


This version
History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
SchunkMotionProtocol-0.1.3.tar.gz (24.2 kB) Copy SHA256 hash SHA256 Source None Jun 16, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page