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.0.tar.gz (2.6 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.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easy_mi_cybergear-1.0.0.tar.gz
  • Upload date:
  • Size: 2.6 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.0.tar.gz
Algorithm Hash digest
SHA256 7cdeb3b141bc5992356f45acfba714f7621143db101427e42c8b48f8aecb6de9
MD5 94829c4e5fe5b475b172cb9e4dfa8555
BLAKE2b-256 1f9397a6dca6ed626251e208a5fa3aaffeca44f960fa64f6d1c396752a955162

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easy_mi_cybergear-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9084004e166672135fdfe6d608fa0615a6ed4397506c6035e2ed1bd6c23aec8b
MD5 dc1270efc18298eed394a3dbc9077f7c
BLAKE2b-256 ba86eb0bcfde9a9b85bbbe2ae2a1f9e4b8cdf62f7f06d4430d1d5c5f9bf05418

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