Skip to main content

pykinisi

Python package for kinisi motor controller. This package is used to control the kinisi motor controller via serial interface.
Description of the commands can be found in Kinisi Motion Controller framework documentation

This version uses messages API 2.1.0, which is incompatible with API 1.x firmware and clients. Connecting exchanges board identity and completes clock setup before returning. See initialization, time sync, and errors for details.

Installation

Install pykinisi with pip:

pip install pykinisi

Controlling Single Motor

This example shows how to connect to the motor controller and control a single motor.\

import time
from pykinisi import *

port = "COM3"

controller = KinisiController()
if not controller.connect(port):
    print(f"Can't connect to {port}: {controller.last_error}")
    exit()

# Motor test
motor_index = MotorIndex.Motor0
speed = 40 # Signed PWM value, -840..840

# Is motor reversed 
is_reversed = False
 
try:
    controller.initialize_motor(motor_index, is_reversed)
    # Set motor speed to speed
    controller.set_motor_speed(motor_index, speed)
    time.sleep(5)
finally:
    try:
        controller.stop_motor(motor_index)
    finally:
        controller.disconnect()

More Examples

There are several examples in the examples folder which show how to use the pykinisi package to control the kinisi motor controller.
Run the examples with:

cd examples
python <example_file> <serial_port>

Initialization.py reports board identity and clock status without enabling motors. Use python Initialization.py <serial_port> --uptime when the host has no valid wall clock.

Package Development

Install pykinisi for development:

pip install -e .

Update KinisiCommands.py file:

cd tools
python update-commands.py --schema ../../kinisi-motor-controller-firmware/commands.json

The command above uses a sibling firmware checkout. Use --branch=<firmware-branch> to fetch a firmware branch containing the API v2 schema instead.

Run tests from the project root with python -m unittest discover -s tests.

Metadata

Release files for pykinisi 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pykinisi 2.1.0
File Size Uploaded
pykinisi-2.1.0.tar.gz 47.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pykinisi 2.1.0
File Interpreter ABI Platform
pykinisi-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 67.2 kB

Release files / pykinisi-2.1.0.tar.gz

Download URL pykinisi-2.1.0.tar.gz
Size 47.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e33b7f9ea563fc8b046a7cfc9cdf6a922ab793e9d9f8613708f02a7b22aa9b56
BLAKE2b-256 checksum
How to use checksums
17e570586e2cec19f8878967689676e4c0295a42803d5cd5780a91e6a31e4a6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release files / pykinisi-2.1.0-py3-none-any.whl

Download URL pykinisi-2.1.0-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19980373c40dbb83d6a22bcbf49a5831f597489a3aa5a8195a5afc0f1c8c2ebc
BLAKE2b-256 checksum
How to use checksums
9b80cc8fe7b7a5d544185f83e29ea8c6458b16e639b754cb8ccc4ffd5c63f615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release history Release notifications | RSS feed

2.3.1

2 release files

This release

2.1.0 This release

2 release files

1.0.6

2 release files

1.0.4

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page