Skip to main content

VSMD

Controller for VSMD can motor

Debug model

Explained by doc file VSMD1X6_SERIES_V1.0.pdf, it's easy to convert can.message to meaningful frame.

bus = can.interface.Bus(bustype='socketcan', channel='can0', bitrate=500000)

while True:
    for msg in bus:
    print("\n%2d\n" % cnt)

    # set debug = true make it to show inf of can-frame
    can_frame = VsmdCanFrame(msg, debug=True)

For an example,say frame 0004079F#0020000000000000 , it can be interpreted as below:

************************************************************                                                                                                             
| Main:  |                                                                                                                                                               
+ Raw                    :  0004079f#0020000000000000
+ Sender                 :  vcan0
+ Extent ID Frame        :  00000000001000000011110011111
+ DLC                    :  8
+ Data Frame             :  ['00200000', '00000000']

| Extend ID Frame |
+ Source Device          :  Pi
+ Target Device          :  BroadCast
+ Command Word           :  11
+ CMD or Register ADR    :  READ_DATA_REGS

| Action |
+ CW Means               :  CMD
| Data Frame |
+ Command                :  [('Data Reg Start:', <DataRegTable.CID: ['0000000', 'Channel ID', 'Determined by motor']>), ('Data Reg count:', 32)]                        
************************************************************

Quick VSMD-CAN setup and drive

See in CommonCMD in VSMD1X6.py

Generate your own CMD

I have sealed most type of command of VSMD in script,you can import them like this:

from VSMD import CommonCMD

Which contains these sub-function:

  • enable_motor(device: str)

    ENA 0x01

    CAN motor is allowed to move after ENA is ON

  • disable_motor(device: str)

    OFF 0x02

    Make CAN motor ignore move cmd. Often used for broadcast

  • move_motor(device: str, speed: int)

    MOV 0x05

    Move motor with specific speed. This is somehow dangerous

  • stop_motor(device: str)

    STP 0x04

    Stop the motor now.

  • move_to(device: str, pos: int)

    POS 0x06

    Mode to absolute pos.

  • move_dis(device: str, dis: int)

    RMV 0x0B

    Mode to relative pos.

  • read_status_regs(device: str, reg: StatusRegTable, cnt: int)

    READ STATUS REGS 0x1E

    Follow the PDF

  • read_data_regs(device: str, reg: DataRegTable, cnt: int)

    READ DATA REGS 0x1F

    Follow the PDF

  • write_data_regs(device: str, reg: DataRegTable, data):

    Note that you must use save after write some registers

Metadata

Release files for VSMD 0.2.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for VSMD 0.2.8
File Size Uploaded
VSMD-0.2.8.tar.gz 13.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for VSMD 0.2.8
File Interpreter ABI Platform
VSMD-0.2.8-py3-none-any.whl Python 3 none any Details

Total release size: 39.5 kB

Release files / VSMD-0.2.8.tar.gz

Download URL VSMD-0.2.8.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
492e4235fea1b97ce0e8560f9584506d43667645112815cdc9d2e034eb597de4
BLAKE2b-256 checksum
How to use checksums
c1fd11020291deeec17242e73e28f159c90850f94e231fd4b2253328b105f296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.4

Release files / VSMD-0.2.8-py3-none-any.whl

Download URL VSMD-0.2.8-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f06d229934185c6c1d770da03f25ae232b66566d710f09874479b0834409bada
BLAKE2b-256 checksum
How to use checksums
647d7c4b16be1e17eab645066d386838f3132ff18b390bd706c36cd286e9876a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.2.8 This release

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

1 release file

0.1.4

1 release file

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page