Skip to main content

使用python通过USB-CAN模块轻松控制小米cybergear微电机

Project description

easy_mi_cybergear

使用python通过USB-CAN模块轻松控制小米cybergear微电机

pip install easy_mi_cybergear
from easy_mi_cybergear import Cybergear
import time
motor = Cybergear(baud_rate=921600, port="COM10")

# 电机使能运行 (通信类型 3) 电机会嗡嗡的响
motor.set_motor_enable(motor_can_id=127)

# 电机停止运行 (通信类型 4)
motor.set_motor_stop(motor_can_id=127)

# 设置电机机械零位(通信类型 6)会把当前电机位置设为机械零位(掉电丢失)
motor.set_motor_zero_position(motor_can_id=127)

# 位置模式,使电机转到2rad的位置,速度限制为1rad/s
motor.set_motor_move_by_position(position=2, speed_limt=10,motor_can_id=127)

time.sleep(1)

# 速度模式,设置电机速度为1rad/s,电流限制为23A(默认值)
motor.set_motor_move_by_speed(speed=1, motor_can_id=127)

time.sleep(2)

# 电机停止运行 (通信类型 4)
motor.set_motor_stop(motor_can_id=127)

TODO

  • 错误判断
  • 读取当前数据

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

easy_mi_cybergear-1.0.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy_mi_cybergear-1.0.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file easy_mi_cybergear-1.0.3.tar.gz.

File metadata

  • Download URL: easy_mi_cybergear-1.0.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for easy_mi_cybergear-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1d10f43511b1e27df5cc2ac5cc736249a432508233e6a54193dbce98cb53cb2f
MD5 a0b531dba28fa2f4d37398f0619ee868
BLAKE2b-256 3ac53b8bd2cca96a0a51c1eb30cb25d9ccfdb2ebd34fe8cf382e77eb86167ba4

See more details on using hashes here.

File details

Details for the file easy_mi_cybergear-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for easy_mi_cybergear-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5889830ec224d42d21f63e165200bda207ef091825cd6d5c8836dcd82fc53010
MD5 5019a5c655f5d9f82fc8244d43aa983f
BLAKE2b-256 583b06d62a24f5e328d281cd8fa60ffff5af9876b3bb1560bb49631de7aebc2d

See more details on using hashes here.

Supported by

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