Package: pymodi
DescriptionPython API for controlling modular electronics, MODI.Promotion VideoFeaturesPyMODI provides a control of modular electronics,MODIPlatform agnostic control of modules through serial connectionExplicit CAN communication to MODI modules via magnetic connectorUtilities of wireless connection with BLE (Bluetooth Low Engery)Update of MODI firmware consisting of both ESP32 and STM32 modulesDirect manipulation of MODI network module usingMODI PlayBuild StatusmasterdevelopSystem SupportSystem3.63.73.8LinuxMac OSWindowsContribution GuidelinesWe appreciate all contributions. If you are planning to report bugs, please do sohere. Feel free to fork our repository to your local environment, and please send us feedback by filing an issue.If you want to contribute to pymodi, be sure to review the contribution guidelines. This project adheres to pymodi's code of conduct. By participating, you are expected to uphold this code.InstallationWhen installing PyMODI package, we highly recommend you to use Anaconda to manage the distribution.
With Anaconda, you can use an isolated virtual environment, solely for PyMODI.[Optional] Once you installAnaconda, then:# Install new python environment for PyMODI package, choose python version >= 3.6
conda create --name pymodi python=3.6

# After you properly install the python environment, activate it
conda activate pymodi

# Ensure that your python version is compatible with PyMODI
python --versionInstall the latest PyMODI if you haven't installed it yet:python -m pip install pymodi --user --upgradeYou can also install PyMODI at develop branch (containing latest changes but it can be unstable) with:python -m pip install git+https://github.com/LUXROBO/pymodi.git@develop --user --upgradeAlternatively, you can install a stable copy of PyMODI at a tag (representing a previous release) with:python -m pip install git+https://github.com/LUXROBO/pymodi.git@v1.0.0 --user --upgradeUsageImport modi package and create MODI object (we call it "bundle", a bundle of MODI modules).# Import modi packageimportmodi"""Create MODI object, make sure that you have connected your network moduleto your machine while other modules are attached to the network module"""bundle=modi.MODI()[Optional] Specify how you would like to establish the connection between your machine and the network module.# 1. Serial connection (via USB), it's the default connection methodbundle=modi.MODI(conn_type="ser")# 2. CAN connection (via CAN shield, not recommended to use it directly)bundle=modi.MODI(conn_type="can")# 3. BLE (Bluetooth Low Energy) connection, it's wireless! But it can be slow :(bundle=modi.MODI(conn_type="ble",network_uuid="YOUR_NETWORK_MODULE_UUID")List and create connected modules' object.# List connected modulesprint(bundle.modules)# List connected ledsprint(bundle.leds)# Pick the first led object from the bundleled=bundle.leds[0]Visualize how modules are connected.# Print topology map without indicating module idbundle.print_topology_map()# Print topology map with module id printedbundle.print_topology_map(print_id=True)Let's blink the LED 5 times.importtimefor_inrange(5):# turn on for 0.5 secondled.turn_on()time.sleep(0.5)# turn off for 0.5 secondled.turn_off()time.sleep(0.5)If you are still not sure how to use PyMODI, you can play PyMODI tutorial over REPL:$ python -m modi --tutorialAs well as an interactive usage examples:$ python -m modi --usageMoreover, we provideapi documentation,usage and creation examples, and adescriptive web page.Additional UsageTo update MODI network module (the network module must be connected on serial),$ python -m modi --update_networkTo update MODI network module's base (as above, the network module must be connected on serial),$ python -m modi --update_network_baseTo update MODI modules (all modules but the network module),$ python -m modi --update_modulesTo diagnose MODI modules (helpful to find existing malfunctioning modules),$ python -m modi --inspectTo debug MODI modules with PyMODI debugger,$ python -m modi --debugTo check the performance of PyMODI on your machine,$ python -m modi --performanceTo initialize MODI modules implicitly (setiflag to enable REPL mode),$ python -im modi --initializeTo see what other commands are available,$ python -m modi --helpSponsored byHistory0.1.0 (2018-06-28)Release initial version of the package on in-house GitLab0.1.1 (2018-07-20)Fix requirementsFix include path0.1.2 (2018-07-23)Python 3.4 support0.2.0 (2018-07-25)Implement Speaker moduleImplement Display module0.2.1 (2018-07-27)Implement speaker module's tune() and off() methodsRemove duplicated codes0.3.0 (2018-07-28)Support python 2.7Speed up the performance0.3.1 (2018-07-28)Fix requirements0.4.0 (2018-08-20)Improve performanceComplete first documentation0.5.0 (2018-08-22)Change the project name to pyMODI0.5.1 (2018-11-07)Fix "No MODI network module connected" issue0.5.2 (2019-10-11)Can control a pair of motors of the motor module by torque(), speed(),
angle()0.6.0 (2019-10-18)Improve performance0.7.0 (2020-01-23)Implement individual motor controlImplement set variable method in displayImplement test cases for each modi modulesImplement multiprocessing version of pymodiBug fixes0.7.1 (2020-02-07)Refactor file structuresBug fixes0.8.0 (2020-05-07)Implement Can Message HandlerImplement Topology ManagerImprove connection reliability by separating communication functionsBug fixes0.9.0 (2020-07-07)Implement Module Firmware UpdaterImplement bluetooth connection via SPPImplement MODI Priority Queue to increase response speedImplement PyMODI tutor for teaching new-comersSupport multi MODI network modules given appropriate COM portsRefactor getter/setter for each MODI moduleRefactor motor module to use set_motor_channel internallyUpdate property values when setting propertiesAdd usage/creation example to the repositoryBug fixes1.0.0 (2020-09-15)Implement Network Firmware UpdaterImplement BLE connection (excluding macOS support)Implement MODI Play support via network moduleRefactor module getter/setter interfaceEnhance topology manager to work with battery moduleAdd functionality to reset existing user code on the modulesBug fixes1.0.1 (2020-10-06)Implement experimental BLE functionality on Windows and macOSImprove BLE connection stability in Linux PlatformImplement module usage manual (i.e. quick-start)Implement module inspection functionality (i.e. diagnose)Refactor GUI debugger design, fix initialization issue on macOS1.1.0 (2020-12-17)Implement GUI Firmware Updater in PyMODIImplement network base (STM32) firmware updaterImplement GD32 firmware updaterImplementVirtualMODIintegration code1.2.0 (2022-02-16)Detach GUI Firmware Updater from PyMODI to individual repoImplement web client method for MODI json connectionPackage PyMODI into a dockerfile via GHCRFix minor bug in BLE connection