# pysmc3 - Python Library for SMC3 Motor Controllers
## Table of Contents
- [About](#about)
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Examples](#examples)
- [Limitations](#limitations)
- [Contributing](#contributing)
- [License](#license)
## About
`pysmc3` is a Python library designed to interact with [SMC3](https://github.com/SimulatorMotorController/SMC3), an Arduino-based software for controlling 3-DOF motion simulators used in gaming. This library provides an alternative to the existing diagnostic tools, which are only available for Windows. The library offers a convenient abstraction of the control box, allowing you to read and write parameters as well as set motor positions.
## Features
- Abstraction of the SMC3 control box through the `smc3.Box` class.
- Asynchronous communications supported by asyncio.
- Methods to read and write parameters for the control box.
- Methods to set motor positions with ease.
## Prerequisites
- Python 3.x
## Installation
Install with pip
```bash
pip instdall smc3
```
Or clone the GitHub repository and install the required dependencies:
```bash
git clone https://github.com/zmij/pysmc3.git
cd pysmc3
pip install -r requirements.txt
```
## Dependencies
* asyncio
* serial_asyncio
* termcolor (for example programs)
## Usage
Here's a quick example snippet that demonstrates how to move Motor A on a sine wave:
```python
from smc3 import Box, MotorNumber
import math
import time
box = Box(device="/dev/tty.usbdevice")
print(f"SMC3 Version: {box.get_version() / 100}")
motor = MotorNumber.A
box.enable_feedback(motor)
try:
while True:
v = int(math.sin(time.clock_gettime(time.CLOCK_MONOTONIC)) * 512) + 512
box.set_position(motor, v)
box.delay(0.01)
except KeyboardInterrupt:
box.disable_feedback()
box.delay(1)
```
### Examples
The repository includes several example programs:
- `show_version.py`: Displays the SMC3 version number.
- `show_status.py`: Shows PID settings for all motors and their current status.
- `sine.py`: Moves a single motor on a sine wave.
- `rock.py`: Rocks the motion simulator back and forth or side to side.
- `puke.py`: Moves all three motors on a sine wave with a phase shift of 2π/3.
## Limitations
While the library has been tested on a MacBook connected to a control box from the DOFReality company, further testing is required to identify potential issues.
## Contributing
Feel free to fork the repository and send pull requests. All contributions are welcome!
## License
Licensed under the [Apache License, Version 2.0](LICENSE.md).
Raw data
{
"_id": null,
"home_page": "https://github.com/zmij/pysmc3",
"name": "smc3",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "motion simulation,motor control,diagnostic tools",
"author": "Sergei A. Fedorov",
"author_email": "sergei.a.fedorov@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/35/a2/2457433f9950cd3508aeea5030fd480049b56ee6f182512d491892d2e0ec/smc3-0.1.1.tar.gz",
"platform": null,
"description": "# pysmc3 - Python Library for SMC3 Motor Controllers\n\n## Table of Contents\n\n- [About](#about)\n- [Features](#features)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Usage](#usage)\n - [Examples](#examples)\n- [Limitations](#limitations)\n- [Contributing](#contributing)\n- [License](#license)\n\n## About\n\n`pysmc3` is a Python library designed to interact with [SMC3](https://github.com/SimulatorMotorController/SMC3), an Arduino-based software for controlling 3-DOF motion simulators used in gaming. This library provides an alternative to the existing diagnostic tools, which are only available for Windows. The library offers a convenient abstraction of the control box, allowing you to read and write parameters as well as set motor positions.\n\n## Features\n\n- Abstraction of the SMC3 control box through the `smc3.Box` class.\n- Asynchronous communications supported by asyncio.\n- Methods to read and write parameters for the control box.\n- Methods to set motor positions with ease.\n\n## Prerequisites\n\n- Python 3.x\n\n## Installation\n\nInstall with pip\n\n```bash\npip instdall smc3\n```\n\nOr clone the GitHub repository and install the required dependencies:\n\n```bash\ngit clone https://github.com/zmij/pysmc3.git\ncd pysmc3\npip install -r requirements.txt\n```\n\n## Dependencies\n\n* asyncio\n* serial_asyncio\n* termcolor (for example programs)\n\n## Usage\n\nHere's a quick example snippet that demonstrates how to move Motor A on a sine wave:\n\n```python\nfrom smc3 import Box, MotorNumber\nimport math\nimport time\n\nbox = Box(device=\"/dev/tty.usbdevice\")\nprint(f\"SMC3 Version: {box.get_version() / 100}\")\n\nmotor = MotorNumber.A\nbox.enable_feedback(motor)\ntry:\n while True:\n v = int(math.sin(time.clock_gettime(time.CLOCK_MONOTONIC)) * 512) + 512\n box.set_position(motor, v)\n box.delay(0.01)\nexcept KeyboardInterrupt:\n box.disable_feedback()\n box.delay(1)\n```\n\n### Examples\n\nThe repository includes several example programs:\n\n- `show_version.py`: Displays the SMC3 version number.\n- `show_status.py`: Shows PID settings for all motors and their current status.\n- `sine.py`: Moves a single motor on a sine wave.\n- `rock.py`: Rocks the motion simulator back and forth or side to side.\n- `puke.py`: Moves all three motors on a sine wave with a phase shift of 2\u03c0/3.\n\n## Limitations\n\nWhile the library has been tested on a MacBook connected to a control box from the DOFReality company, further testing is required to identify potential issues.\n\n## Contributing\n\nFeel free to fork the repository and send pull requests. All contributions are welcome!\n\n## License\n\nLicensed under the [Apache License, Version 2.0](LICENSE.md).\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Simulation Motor Controller interface",
"version": "0.1.1",
"project_urls": {
"Download": "https://github.com/zmij/pysmc3/archive/refs/tags/v0.1.tar.gz",
"Homepage": "https://github.com/zmij/pysmc3"
},
"split_keywords": [
"motion simulation",
"motor control",
"diagnostic tools"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "35a22457433f9950cd3508aeea5030fd480049b56ee6f182512d491892d2e0ec",
"md5": "4f5459aeaabcaca4bfbb7b7eff573d67",
"sha256": "6cd1f675860988bc22ffa85c7281d7f9247dafc11cf4108ba48840b6335da98f"
},
"downloads": -1,
"filename": "smc3-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "4f5459aeaabcaca4bfbb7b7eff573d67",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12919,
"upload_time": "2023-11-01T22:38:25",
"upload_time_iso_8601": "2023-11-01T22:38:25.437986Z",
"url": "https://files.pythonhosted.org/packages/35/a2/2457433f9950cd3508aeea5030fd480049b56ee6f182512d491892d2e0ec/smc3-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-01 22:38:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zmij",
"github_project": "pysmc3",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "smc3"
}