moteus


Namemoteus JSON
Version 0.3.67 PyPI version JSON
download
home_pagehttps://github.com/mjbots/moteus
Summarymoteus brushless controller library and tools
upload_time2024-01-12 20:33:45
maintainer
docs_urlNone
authormjbots Robotic Systems
requires_python>=3.7, <4
license
keywords moteus
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # Python bindings for moteus brushless controller #

These bindings permit communication and control of moteus brushless
controllers.

## To use ##

```
pip3 install moteus  # or 'moteus-pi3hat' on a pi3hat
```

See a simple example of the API in use at: [simple.py](examples/simple.py)

## Theory ##

Interactions with a controller are mediated through the
`moteus.Controller` object.  When constructed with the constructor
argument `transport=None` (the default) it attempts to find some
suitable link on your host system, typically the first fdcanusb or
socketcan bus it locates.

Single controller imperative operation can be conducted by using
`await Controller.set_stop()`, `await Controller.set_position()`, and
`await Controller.query()`.

## Bus-optimized usage ##

To optimize bus usage, it is possible to command multiple controllers
simultaneously.  In this mode, a "transport" must be manually
constructed.

```
import asyncio
import math
import moteus

async def main():
    transport = moteus.Fdcanusb()
    c1 = moteus.Controller(id = 1)
    c2 = moteus.Controller(id = 2)

    while True:
        print(await transport.cycle([
          c1.make_position(position=math.nan, query=True),
          c2.make_position(position=math.nan, query=True),
        ]))

asyncio.run(main())
```

All of the "set_" methods have a "make_" variant which is suitable to
pass to a Transport's `cycle` method.

This mechanism only improves performance for non-fdcanusb links, such
as a pi3hat.

An example use of this mechanism can be found at:
[pi3hat_multiservo.py](examples/pi3hat_multiservo.py)

## Position mode commands ##

`Controller.set_position` and `Controller.make_position` have
arguments which exactly mirror the fields documented in
`docs/reference.md`.  Omitting them (or specifying None), results in
them being omitted from the resulting register based command.

* position
* velocity
* feedforward_torque
* kp_scale
* maximum_torque
* stop_position
* watchdog_timeout

Finally, the `query` argument controls whether information is queried
from the controller or not.

## Controlling resolution ##

The resolution of commands, and of returned query data, is controlled
by optional constructor arguments to `Controller`.  By default, the
commands are all F32, and the query requests a subset of fields as
INT16.  Here is an example of setting those.

```
pr = moteus.PositionResolution()
pr.position = moteus.INT16
pr.velocity = moteus.INT16
pr.kp_scale = moteus.F32
pr.kd_scale = moteus.F32

qr = moteus.QueryResolution()
qr.mode = mp.INT8
qr.position = mp.F32
qr.velocity = mp.F32
qr.torque = mp.F32

c = moteus.Controller(position_resolution=pr, query_resolution=qr)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mjbots/moteus",
    "name": "moteus",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7, <4",
    "maintainer_email": "",
    "keywords": "moteus",
    "author": "mjbots Robotic Systems",
    "author_email": "info@mjbots.com",
    "download_url": "https://files.pythonhosted.org/packages/86/2a/5d6011a350f0659541b210a7d5f17549bbe5c9d8289d8f7c31bbaae3bf13/moteus-0.3.67.tar.gz",
    "platform": null,
    "description": "# Python bindings for moteus brushless controller #\n\nThese bindings permit communication and control of moteus brushless\ncontrollers.\n\n## To use ##\n\n```\npip3 install moteus  # or 'moteus-pi3hat' on a pi3hat\n```\n\nSee a simple example of the API in use at: [simple.py](examples/simple.py)\n\n## Theory ##\n\nInteractions with a controller are mediated through the\n`moteus.Controller` object.  When constructed with the constructor\nargument `transport=None` (the default) it attempts to find some\nsuitable link on your host system, typically the first fdcanusb or\nsocketcan bus it locates.\n\nSingle controller imperative operation can be conducted by using\n`await Controller.set_stop()`, `await Controller.set_position()`, and\n`await Controller.query()`.\n\n## Bus-optimized usage ##\n\nTo optimize bus usage, it is possible to command multiple controllers\nsimultaneously.  In this mode, a \"transport\" must be manually\nconstructed.\n\n```\nimport asyncio\nimport math\nimport moteus\n\nasync def main():\n    transport = moteus.Fdcanusb()\n    c1 = moteus.Controller(id = 1)\n    c2 = moteus.Controller(id = 2)\n\n    while True:\n        print(await transport.cycle([\n          c1.make_position(position=math.nan, query=True),\n          c2.make_position(position=math.nan, query=True),\n        ]))\n\nasyncio.run(main())\n```\n\nAll of the \"set_\" methods have a \"make_\" variant which is suitable to\npass to a Transport's `cycle` method.\n\nThis mechanism only improves performance for non-fdcanusb links, such\nas a pi3hat.\n\nAn example use of this mechanism can be found at:\n[pi3hat_multiservo.py](examples/pi3hat_multiservo.py)\n\n## Position mode commands ##\n\n`Controller.set_position` and `Controller.make_position` have\narguments which exactly mirror the fields documented in\n`docs/reference.md`.  Omitting them (or specifying None), results in\nthem being omitted from the resulting register based command.\n\n* position\n* velocity\n* feedforward_torque\n* kp_scale\n* maximum_torque\n* stop_position\n* watchdog_timeout\n\nFinally, the `query` argument controls whether information is queried\nfrom the controller or not.\n\n## Controlling resolution ##\n\nThe resolution of commands, and of returned query data, is controlled\nby optional constructor arguments to `Controller`.  By default, the\ncommands are all F32, and the query requests a subset of fields as\nINT16.  Here is an example of setting those.\n\n```\npr = moteus.PositionResolution()\npr.position = moteus.INT16\npr.velocity = moteus.INT16\npr.kp_scale = moteus.F32\npr.kd_scale = moteus.F32\n\nqr = moteus.QueryResolution()\nqr.mode = mp.INT8\nqr.position = mp.F32\nqr.velocity = mp.F32\nqr.torque = mp.F32\n\nc = moteus.Controller(position_resolution=pr, query_resolution=qr)\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "moteus brushless controller library and tools",
    "version": "0.3.67",
    "project_urls": {
        "Homepage": "https://github.com/mjbots/moteus"
    },
    "split_keywords": [
        "moteus"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "77202c8f19a26f6a420c7b5f47fc1f492cea70c39aa0334dfca43ef1ebd458e1",
                "md5": "0a35117cf6330673d4a3ef9e7f1a6ab4",
                "sha256": "e523940d6fffbefefe4ca821db801a1620657730e4d3f18444d24ead01424d40"
            },
            "downloads": -1,
            "filename": "moteus-0.3.67-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0a35117cf6330673d4a3ef9e7f1a6ab4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7, <4",
            "size": 52970,
            "upload_time": "2024-01-12T20:33:41",
            "upload_time_iso_8601": "2024-01-12T20:33:41.305013Z",
            "url": "https://files.pythonhosted.org/packages/77/20/2c8f19a26f6a420c7b5f47fc1f492cea70c39aa0334dfca43ef1ebd458e1/moteus-0.3.67-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "862a5d6011a350f0659541b210a7d5f17549bbe5c9d8289d8f7c31bbaae3bf13",
                "md5": "415d76731da6bd70fc28861671fae42c",
                "sha256": "a2122f20f59b8962057cf8d3fb583e0aa19006eaf2cde49e30027a4d1b8bf925"
            },
            "downloads": -1,
            "filename": "moteus-0.3.67.tar.gz",
            "has_sig": false,
            "md5_digest": "415d76731da6bd70fc28861671fae42c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7, <4",
            "size": 44710,
            "upload_time": "2024-01-12T20:33:45",
            "upload_time_iso_8601": "2024-01-12T20:33:45.193445Z",
            "url": "https://files.pythonhosted.org/packages/86/2a/5d6011a350f0659541b210a7d5f17549bbe5c9d8289d8f7c31bbaae3bf13/moteus-0.3.67.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-12 20:33:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mjbots",
    "github_project": "moteus",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "moteus"
}
        
Elapsed time: 0.20735s