Skip to content

Latest commit

 

History

History
98 lines (70 loc) · 6.23 KB

README.md

File metadata and controls

98 lines (70 loc) · 6.23 KB

Spectral-BLDC

Python library for the Spectral Micro and STEPFOC motor drivers, over CAN. Send commands to every driver on the bus and read its encoder, current, temperature, voltage and errors; it also drives the SSG-48 and MSG grippers.

Documentation · PyPI · Examples · Discord

PyPI Python License Discord

Install

pip install Spectral-BLDC

You need a CAN adapter that speaks slcan, such as the CANvas USB-to-CAN adapter.

Quick start

import Spectral_BLDC as Spectral
import time


Communication1 = Spectral.CanCommunication(bustype='slcan', channel='COM41', bitrate=1000000)
Motor1 = Spectral.SpectralCAN(node_id=0, communication=Communication1)

while True:

    Motor1.Send_Respond_Encoder_data()

    message, UnpackedMessageID = Communication1.receive_can_messages(timeout=0.2)

    if message is not None:

        Motor1.UnpackData(message,UnpackedMessageID)
        print(f"Motor position is: {Motor1.position}")
        print(f"Motor speed is: {Motor1.speed}")

    else:
        print("No message after timeout period!")
    print("")
    time.sleep(1 )

Every command and its fields: the CAN reference in the Spectral Micro manual, and the same for STEPFOC.

Works with

Product Firmware Library Repository
Spectral Micro BLDC controller 107 1.20 or newer Spectral-Micro-BLDC-controller
STEPFOC stepper controller 108 1.20 or newer STEPFOC-stepper-controller
SSG-48 adaptive electric gripper Spectral Micro firmware as for Spectral Micro SSG-48-adaptive-electric-gripper
MSG compliant AI stepper gripper STEPFOC firmware as for STEPFOC MSG-compliant-AI-stepper-gripper

Older firmware: the compatibility pages of the Spectral Micro and STEPFOC manuals.

Examples

In examples:

Example What it does
Send_respond_1.py goes through the commands: settings, gains, limits, the gripper commands, and reads the answers
Get_encoder_data.py reads the encoder position and speed
SSG48_gripper_test.py clears the errors, calibrates and moves the SSG-48 gripper
Advanced/Bilateral teleop 2DOF bilateral teleoperation with two motors, also over UDP with a Raspberry Pi
Advanced/Gravity compensation a single link that holds itself against gravity, with its BOM, STL files and setup guide
Advanced/SSG48 gripper bilateral teleop bilateral teleoperation with the SSG-48 gripper

Community

Ask in Discussions, chat on Discord, report a bug in Issues. Follow Source Robotics:

Discord Discussions YouTube Instagram X LinkedIn Blog

Licensing

The library is under the MIT License.