Skip to main content

Package for operating STANDA 8SMC5 controllers

Project description

libximc

This is a python binding for libximc - cross-platform library for Standa 8SMC5-USB motor controllers.

8SMC5-based devices

Libximc manages hardware using interfaces: USB 2.0, RS232 and Ethernet, also uses a common and proven virtual serial port interface, so you can work with motor control modules through this library under Windows and Linux. MacOS X isn't supported yet.

This library also supports virtual devices. So you can make some tests without real hardware.

Installation

pip install libximc

Minimal new API example

import time
import libximc.highlevel as ximc

# Virtual device will be used by default.
# In case you have real hardware, set correct device URI here

device_uri = r"xi-emu:///ABS_PATH/virtual_controller.bin"  # Virtual device
# device_uri = r"xi-com:\\.\COM111"                        # Serial port
# device_uri = "xi-tcp://172.16.130.155:1820"              # Raw TCP connection
# device_uri = "xi-net://192.168.1.120/abcd"               # XiNet connection

axis = ximc.Axis(device_uri)
axis.open_device()

print("Launch movement...")
axis.command_right()

time.sleep(3)

print("Stop movement")
axis.command_stop()

print("Disconnect device")
axis.close_device()  # It's also called automatically by the garbage collector, so explicit closing is optional

print("Done")

Full new API example

See Colab notebook for full example: https://colab.research.google.com/drive/1xJawpc-0CIZLDlwkefzSgWrAyBVSlaMl

Detailed view on new API

We are glad to introduce new libximc highlevel API! You can access it via:

import libximc.highlevel as ximc

New API principles

  • All controller related functions are methods of an Axis class:

    # Axis constructor takes device URI as string (not bytes)
    axis = ximc.Axis("xi-emu:///home/user/virtual-device.bin")
    axis.device_open()  # Note: device must be opened manually
    
    axis.command_move(10, 0)
    
    # Note: device closing, axis.close_device(), is performed automatically by the garbage collector.
    

    Other libximc functions can be accessed via ximc itself, e.g. ximc.ximc_version().

  • As you could notice, there is no need to pass device_id to the commands any more. Axis class does it internally.

  • You don't need to pass the calibration_t structure to the *_calb functions. Instead, set calibrations via axis.set_calb(A, MicrostepMode) and then use any *_calb function:

    axis.set_calb(0.048, ximc.MicrostepMode.MICROSTEP_MODE_FRAC_256)
    
    axis.command_move_calb(12.3)
    
  • All flags' enumerations are placed in ximc. For example, to get EnumerationFlags use ximc.EnumerateFlags.<desired-flag>.

  • All C-legacy exit status codes are transformed to Python exceptions.

  • In case you want to get any available data structure from the controller, you don't need to create an empty data structure and pass it to corresponding function. Instead, use single-line instruction, like:

    # Example for move_settings. You can use your desired get_*() command
    move_settings = axis.get_move_settings()
    
  • ximc.enumerate_devices() returns list of dictionaries containing information about found devices. Hint: to get full information about devices, use flag ximc.EnumerationFlags.EnumerateFlags.ENUMERATE_PROBE:

    # Get full information while enumerating
    ximc.enumerate_devices(ximc.EnumerateFlags.ENUMERATE_PROBE)
    
  • Manufactures-only functions aren't supported.

  • Logging functions aren't supported.

I want to use the old version. What should I do?

If you want to use the old API (lowlevel libximc), don't worry. Just

import libximc.lowlevel as ximc  # Such an import provides you with the old version of the libximc binding

More information

If you have faced any issues while using the library and you have no idea how to solve them, contact technical support via:

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

libximc-2.14.26.tar.gz (5.8 MB view details)

Uploaded Source

Built Distribution

libximc-2.14.26-py3-none-any.whl (5.8 MB view details)

Uploaded Python 3

File details

Details for the file libximc-2.14.26.tar.gz.

File metadata

  • Download URL: libximc-2.14.26.tar.gz
  • Upload date:
  • Size: 5.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.18 tqdm/4.64.1 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for libximc-2.14.26.tar.gz
Algorithm Hash digest
SHA256 260bb38af73e4eafa73d158db0465600a4162f3785f514fc25369407f9d39f3d
MD5 451f8734b2bce87d10fd5ff3c4426c29
BLAKE2b-256 cef94d468759cbb1e03dac163e95baf50be3748a6cb909d5d4a79945381b03ad

See more details on using hashes here.

File details

Details for the file libximc-2.14.26-py3-none-any.whl.

File metadata

  • Download URL: libximc-2.14.26-py3-none-any.whl
  • Upload date:
  • Size: 5.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.18 tqdm/4.64.1 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for libximc-2.14.26-py3-none-any.whl
Algorithm Hash digest
SHA256 8d139fc72561607437a7759c086f046063e15ef2e9682864f590ba8c21380b20
MD5 57ae0bfacf642ac399e30382837dcbb6
BLAKE2b-256 1e41c70df584d4a296d3ba4f9a474cdcbdc0c7ec184525e20bf3e8c728155daf

See more details on using hashes here.

Supported by

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