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


Release history Release notifications

This version

0.1.0

Download files

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

Files for dicot, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size dicot-0.1.0-py3-none-any.whl (6.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dicot-0.1.0.tar.gz (6.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page