Skip to content

PCrnjak/Spectral-BLDC-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spectral-BLDC

License: MIT Issues release

Python lib for controlling spectral BLDC controllers and SSG-48 gripper over CAN bus. For more info about this API and all available commands check DOCS

How to install

pip install Spectral-BLDC

Basic example

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 )

More examples

Check out the Examples folder for more examples! Available examples:

  • Send_respond_1
  • Get_encoder_data
  • SSG48_gripper_test

This project is entirely open-source and free for all to use. Any support, whether through donations or advice, is greatly appreciated. Thank you!

General badge General badge

About

Python lib for controlling spectral BLDC controllers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages