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.5.tar.gz (4.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.5-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easy_mi_cybergear-1.0.5.tar.gz
  • Upload date:
  • Size: 4.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.5.tar.gz
Algorithm Hash digest
SHA256 5fc60f0504493afa08d3618750aea6ff9b5e37b4c987bbe542c70c281ad5b7c1
MD5 582f7e1beb365bb054007a0e0a3afb0f
BLAKE2b-256 e20039d9737ea1192958b9a6264352f6ffcfb562e8fc68a5c749083e5e0bcf58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easy_mi_cybergear-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8e7b7a351dbaa4ef475b53f0e7990544a0eef439d847c51d3d77602e88d0da80
MD5 568e0945edde0d44fc7e025dd9d344bf
BLAKE2b-256 1def4c3aeb8b68ff43755a7f08b5314ec6575a36bbac487e18f3d1199eb73a71

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