Skip to main content

Controls Futaba Command-Type Servo motors.

Project description

dicot

Controls Futaba Command-Type Servo motors. It is developed and tested with RS204MD.

Installation

$ pip install dicot

Usage

Create the serial port connection, enable the torque, and set the motor angle:

>>> improt dicot
>>>
>>> cnx = dicot.open('COM1')
>>>
>>> motor = cnx.motor(1)  # id = 1
>>> motor.torque_enabled = True
>>>
>>> motor.angle = 45  # degree

Or set with duration:

>>> motor.rotate(90, msec=5000)  # with duration

Can get and set various parameters through the attributes:

>>> motor.angle
90  # degree
>>>
>>> motor.load
6  # mA
>>>
>>> motor.temperature
30  # Celsius
>>>
>>> motor.voltage
5.2  # V
>>>
>>> motor.max_torque = 80  # %
>>> motor.pid_coeff = 100  # %

The value set in the ROM area must be written by executing motor.rom.write() in order to retain it even after the motor is turned off:

>>> motor.torque_enabled = False
>>> motor.rom.cw_angle_limit = 100  # degree
>>> motor.rom.ccw_compliance_margin = 0.2  # degree
>>> motor.rom.ccw_compliance_slope = 20  # degree
>>> motor.rom.write()

Can also change the ID:

>>> motor.rom.id = 2
>>> motor.rom.write()

MotorList can handle multiple motors collectively:

>>> motors = dicot.MotorList([motor, cnx.motor(2), cnx.motor(3)])
>>> motors.torque_enabled = True
>>> motors.angles = [30, 60, 90]

The connection object supports the with statement:

import dicot

with dicot.open('COM1') as cnx:
    motor = cnx.motor(1)
    print(motor.firm_version)

Project details


Download files

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

Source Distribution

dicot-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

dicot-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file dicot-0.1.0.tar.gz.

File metadata

  • Download URL: dicot-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.2 Windows/10

File hashes

Hashes for dicot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 55db4ffb9e284e03c85ef6f908e29e2bd1c9ade84c16aa73ce6cf705eb89e1ff
MD5 463e9554a815ac1b74b4e26634768dd2
BLAKE2b-256 f0331ed274242514bba29294a52e85bd83db3a3064fa8d5039685876f7f247ad

See more details on using hashes here.

File details

Details for the file dicot-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dicot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.2 Windows/10

File hashes

Hashes for dicot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56d108e519711df48da65412547996f300b1f8f3359d243b5138a2b533d4806d
MD5 0a598ab3a20423b4fe947ae9b320f29c
BLAKE2b-256 332471fe6e0159a94939fe6bc9f36e93352c957e2df6e5ba45cc82ed12a3be0d

See more details on using hashes here.

Supported by

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