https://github.com/pcrnjak/spectral-bldc-python
Python lib for controlling spectral BLDC controllers.
https://github.com/pcrnjak/spectral-bldc-python
bldc foc robot robotics spectral
Last synced: 9 months ago
JSON representation
Python lib for controlling spectral BLDC controllers.
- Host: GitHub
- URL: https://github.com/pcrnjak/spectral-bldc-python
- Owner: PCrnjak
- License: mit
- Created: 2024-02-21T17:08:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-26T10:55:52.000Z (over 1 year ago)
- Last Synced: 2025-07-19T02:00:59.211Z (11 months ago)
- Topics: bldc, foc, robot, robotics, spectral
- Language: Python
- Homepage:
- Size: 3.05 MB
- Stars: 23
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Spectral-BLDC
[](https://opensource.org/licenses/MIT)  
Python lib for controlling [spectral BLDC](https://github.com/PCrnjak/Spectral-Micro-BLDC-controller/blob/main/README.md) controllers and [SSG-48 gripper](https://github.com/PCrnjak/SSG-48-adaptive-electric-gripper) over CAN bus.
For more info about this API and all available commands check [DOCS](https://source-robotics.github.io/Spectral-BLDC-docs/apage7_can/)
# How to install
pip install Spectral-BLDC
# Basic example
``` py
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](https://github.com/PCrnjak/Spectral-BLDC-Python/tree/main/examples) 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!
[](https://paypal.me/PCrnjak?locale.x=en_US)
[](https://www.patreon.com/PCrnjak)