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

API v2 is incompatible with API v1. See protocol 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 percentage, -100..100

# 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

See the motor position and platform position examples for position control.

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.3.1

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.3.1
File Size Uploaded
pykinisi-2.3.1.tar.gz 51.6 kB Details

Built distribution (wheel)

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

Total release size: 73.4 kB

Release files / pykinisi-2.3.1.tar.gz

Download URL pykinisi-2.3.1.tar.gz
Size 51.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3bd1a1886adff7a5bbec610b7fbb57cdc6f452b50f15e0d6679a9a30082c611d
BLAKE2b-256 checksum
How to use checksums
ce02119e11cf259962e18ee6fae1417bb47f3fb8a21637c0746fa02008092e64
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.3.1-py3-none-any.whl

Download URL pykinisi-2.3.1-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1ed6a07320ab218bd74f39f0c5b7780e43821cb48bfef967bf456f72406544b
BLAKE2b-256 checksum
How to use checksums
ce1007678eda981249a21251e50a67fcc60033379e279a7bff34163bbab84b92
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

This release

2.3.1 This release

2 release files

2.1.0

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