Skip to main content

No project description provided

Project description

RoboClaw Encoder Interface

This project provides an interface for controlling and reading encoder values from RoboClaw motor controllers. It allows you to set motor speeds, control motor movement, and read encoder values with proper handling of overflow, underflow, and direction. Features

Control Motors: Set speed for individual motors (M1, M2).
Drive Both Motors: Control both motors at the same time with forward or backward movement.
Turn Both Motors: Control turning by adjusting motor speeds in opposite directions.
Read Encoder: Accurately read encoder values, adjusting for overflow and underflow.

System Requirements

This library works on windows x86, linux x86 and linux aarch64 machines. Linux supports glibc or musl. Python version needs to be 3.7 or higher.

Installation

pip install roboclaw-python

Usage

Example in Python using the PyO3 bindings

from roboclaw_python import RoboClaw, Motor

Initialize RoboClaw

roboclaw = RoboClaw(port_name="/dev/ttyUSB0", baud_rate=115200, timeout=20, retries=128, address=128)

Set motor speed

roboclaw.set_speed(Motor.M1, 100)

Read encoder value

encoder_value_m1 = roboclaw.read_encoder(Motor.M1)
print(f"Motor M1 Encoder: {encoder_value_m1}")

Currently supported

set_speed()                 M1 + M2 Forward and Backwards
drive()                     Both motors forwards and backwards at the same time
turn()                      Turn one or the other motor

//Encoders
read_encoder()              Reads the encoder of a specified motor
read_encoder_speed()        Read the speed of the encoder in counts per second
reset_encoders()            Resets both encoders
set_encoder()               Sets the encoder value of a specified motor
read_raw_speed()            Reads the raw speed of the encoders
read_avg_speed()            Reads the average speed of the encoders
read_speed_error()          Reads speed error
read_position_error()       Read position error

//Advanced motor controls
set_velocity_pid()          28 / 29
set_speed_duty()            32 / 33
drive_duty()                34

//Advanced Commands
set_serial_timeout()        Sets the serial timeout
read_serial_timeout()       Reads the serial timeout

External links

License

This project is licensed under the MIT License.

This is an unofficial roboclaw driver for python. I'm not affiliated with Basic Micro.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

roboclaw_python-0.9.0-cp37-abi3-win_amd64.whl (171.7 kB view details)

Uploaded CPython 3.7+Windows x86-64

roboclaw_python-0.9.0-cp37-abi3-musllinux_1_2_x86_64.whl (410.7 kB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ x86-64

roboclaw_python-0.9.0-cp37-abi3-musllinux_1_2_aarch64.whl (390.4 kB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ARM64

roboclaw_python-0.9.0-cp37-abi3-manylinux_2_34_x86_64.whl (441.3 kB view details)

Uploaded CPython 3.7+manylinux: glibc 2.34+ x86-64

roboclaw_python-0.9.0-cp37-abi3-manylinux_2_34_aarch64.whl (441.6 kB view details)

Uploaded CPython 3.7+manylinux: glibc 2.34+ ARM64

File details

Details for the file roboclaw_python-0.9.0-cp37-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for roboclaw_python-0.9.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 73624f01b160a1441201de1b8c3c5e5df7ab46413a25623b393848fd951b11e0
MD5 371f93468dae1772c1ad950d8a2f5e12
BLAKE2b-256 a24ed7a5bbe1751c86a2a816fed9a5bac179a6877d9c2b9d4ccbf74f93605669

See more details on using hashes here.

File details

Details for the file roboclaw_python-0.9.0-cp37-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for roboclaw_python-0.9.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 10ebd6699e7c41ab7f80b5bb5beb1c00b90d88874e44b5e69aa71c79cb7e122c
MD5 c80fec546a14bacb96d908a79f701ec0
BLAKE2b-256 415410e5a78c59a2e42576157ae6817616bd70f843c4c9ee012c53dc6d0c2fb5

See more details on using hashes here.

File details

Details for the file roboclaw_python-0.9.0-cp37-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for roboclaw_python-0.9.0-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 502225ae93c919b9a4e4c4f073ee92328d3a77bdf640ab514666a389be88b805
MD5 2b9950b09b7db990d872c9e6e7283005
BLAKE2b-256 ddda0b60a47c119c55eedb044d6f7a02c86956124c92ff6e0a87d2405dbc3e80

See more details on using hashes here.

File details

Details for the file roboclaw_python-0.9.0-cp37-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for roboclaw_python-0.9.0-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9b5c9daa3f0e452c8ade3674c041de9be8ecb643b5fd2373a9379375184ab66f
MD5 3649fa886a837f413544ddb6ddaef907
BLAKE2b-256 c82c7623ec4d975d6ad616d72647277610327618968c63ed284f898c07d3e05c

See more details on using hashes here.

File details

Details for the file roboclaw_python-0.9.0-cp37-abi3-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for roboclaw_python-0.9.0-cp37-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 3e639c832e4598ac5a83a00efb20f43a51dbf10a384c4b094374a054f5f1c41c
MD5 0ad006cca9c1a8fc5f70377b52a41367
BLAKE2b-256 5a2eaa86886a4cfd019f30751aa9abd08b08ac9ae670283b77b0aca864ec1dca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page