brom-drake


Namebrom-drake JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryA set of convenient logging and testing tools for the Drake robotics toolbox.
upload_time2024-04-26 21:10:03
maintainerNone
docs_urlNone
authorKwesi Rutledge
requires_pythonNone
licenseNone
keywords drake robotics testing logging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![codecov](https://codecov.io/gh/kwesiRutledge/brom_drake-py/graph/badge.svg?token=0TI5PV2HUD)](https://codecov.io/gh/kwesiRutledge/brom_drake-py)

# brom_drake-py
Brom is a helper library for the [Drake](https://drake.mit.edu/) robotics simulation and verification library.
Its goal is to simplify common debugging and testing activities in Drake (for example, logging the outputs
of systems in your block diagrams). 

Some of Brom's features:

Feature                    |  Code | Results
:-------------------------:|:-------------------------:|:-------------------------:
The Diagram Watcher (the `DiagramWatcher` will log + plot all output ports of your `Diagram` automatically) |`add_watcher_and_build()`| ![Creation of Brom Directory](./promo/BromWatcher0.gif)

(More coming soon...)

## Installation

`brom_drake` is available on PyPI and installable with pip:

```shell
pip install brom-drake
```

### Developer install

You can also install the package during local development by cloning
the repository and running the following commands from inside it:

```bash
pip install -r requirements.txt
pip install -e .
```

## Use Cases

Here are a few of the features available in `brom_drake` and how they work.

### Easily Log Your Diagram's Signals

It is recommended that you use the convenience function `add_watcher_and_build` to add a `DiagramWatcher` to your diagram.

```python
# Drake imports
from pydrake.all import (
    DiagramBuilder, Simulator,
)
# All your other imports

from brom_drake.all import add_watcher_and_build

# Create a diagram builder
builder = DiagramBuilder()

# Add and connect your systems...

# Add the watcher and build the diagram
watcher, diagram, diagram_context = add_watcher_and_build(builder)

# Set up simulation
simulator = Simulator(diagram, diagram_context)
simulator.set_target_realtime_rate(1.0)
simulator.set_publish_every_time_step(False)

# Run simulation
simulator.Initialize()
simulator.AdvanceTo(15.0)

```


What will happen whenever you use this function is that:
- The `DiagramWatcher` will be created.
  - It will search through all systems that the `DiagramBuilder` has added.
  - For each system, the watcher will add a `VectorLogger` to each output port that is a `kVectorValued` port.
  - The `DiagramWatcher` will connect all loggers to all targeted ports (in the above case, we will target all available output ports).
- After the simulation is run and the script completes, the watcher will save all data traces for each port in `.png` files. These plots will be in a new `.brom` directory.

### Watching Specific systems

If you only want to watch a specific system, then you can do so by passing in information to the "targets" argument:
```python
watcher, _, _ = add_watcher_and_build(
  builder,
  targets=[
    ("system_name", "port_name"),
    "system_name2",
  ],
)
```
The above code tells the watcher to watch the port named `port_name` on the system named `system_name`.
(If you don't know your system's name in Drake, then you can usually find it by using the `get_name()` method.)

## FAQs

### Why the name Brom?

[Brom the storyteller](https://inheritance.fandom.com/wiki/Brom) is a character from the
[Inheritance](https://en.wikipedia.org/wiki/Eragon) series by Christopher Paolini.
He is a wise mentor that helps Eragon (the protagonist) master dragons. ;)

 

## Related Work

Some other work in the open-source drake community:
- [kinova_drake](https://github.com/vincekurtz/kinova_drake) - A Drake-based library that builds a 
  simple version of the manipulation station for the Kinova Gen3 robot arm.
  Also works with the hardware.
- [airo-drake](https://github.com/airo-ugent/airo-drake) - A python package meant to simplify
  working with Drake and the `airo-mono` repository from the AI and Robotics Lab at Ghent University.

## To-Dos

- [ ] Figure out how to tell if two systems are connected in Drake.
- [x] Demonstrate how to create a simple Vector logger for the
  tutorial's diagram.
  - [x] Determine if we can use `DiagramTarget` objects to do everything (assuming that they are all valid). i.e., with the name and the port # can we do waht we want?
- [ ] Add more examples
- [x] Add Code coverage
- [ ] Add support for abstract output ports?
- [ ] Add more readme explanations of what is going on under the hood.
- [ ] Add support for giving `DiagramTarget` (or simpler objects) to the convenience functions.
- [x] Add to PyPI

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "brom-drake",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "drake, robotics, testing, logging",
    "author": "Kwesi Rutledge",
    "author_email": "thesolitaryecrivain@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7e/b3/a692a120d43222de4453ea8bef175866fb8b43b77513edaabaa4e974f90a/brom_drake-0.1.1.tar.gz",
    "platform": null,
    "description": "\n[![codecov](https://codecov.io/gh/kwesiRutledge/brom_drake-py/graph/badge.svg?token=0TI5PV2HUD)](https://codecov.io/gh/kwesiRutledge/brom_drake-py)\n\n# brom_drake-py\nBrom is a helper library for the [Drake](https://drake.mit.edu/) robotics simulation and verification library.\nIts goal is to simplify common debugging and testing activities in Drake (for example, logging the outputs\nof systems in your block diagrams). \n\nSome of Brom's features:\n\nFeature                    |  Code | Results\n:-------------------------:|:-------------------------:|:-------------------------:\nThe Diagram Watcher (the `DiagramWatcher` will log + plot all output ports of your `Diagram` automatically) |`add_watcher_and_build()`| ![Creation of Brom Directory](./promo/BromWatcher0.gif)\n\n(More coming soon...)\n\n## Installation\n\n`brom_drake` is available on PyPI and installable with pip:\n\n```shell\npip install brom-drake\n```\n\n### Developer install\n\nYou can also install the package during local development by cloning\nthe repository and running the following commands from inside it:\n\n```bash\npip install -r requirements.txt\npip install -e .\n```\n\n## Use Cases\n\nHere are a few of the features available in `brom_drake` and how they work.\n\n### Easily Log Your Diagram's Signals\n\nIt is recommended that you use the convenience function `add_watcher_and_build` to add a `DiagramWatcher` to your diagram.\n\n```python\n# Drake imports\nfrom pydrake.all import (\n    DiagramBuilder, Simulator,\n)\n# All your other imports\n\nfrom brom_drake.all import add_watcher_and_build\n\n# Create a diagram builder\nbuilder = DiagramBuilder()\n\n# Add and connect your systems...\n\n# Add the watcher and build the diagram\nwatcher, diagram, diagram_context = add_watcher_and_build(builder)\n\n# Set up simulation\nsimulator = Simulator(diagram, diagram_context)\nsimulator.set_target_realtime_rate(1.0)\nsimulator.set_publish_every_time_step(False)\n\n# Run simulation\nsimulator.Initialize()\nsimulator.AdvanceTo(15.0)\n\n```\n\n\nWhat will happen whenever you use this function is that:\n- The `DiagramWatcher` will be created.\n  - It will search through all systems that the `DiagramBuilder` has added.\n  - For each system, the watcher will add a `VectorLogger` to each output port that is a `kVectorValued` port.\n  - The `DiagramWatcher` will connect all loggers to all targeted ports (in the above case, we will target all available output ports).\n- After the simulation is run and the script completes, the watcher will save all data traces for each port in `.png` files. These plots will be in a new `.brom` directory.\n\n### Watching Specific systems\n\nIf you only want to watch a specific system, then you can do so by passing in information to the \"targets\" argument:\n```python\nwatcher, _, _ = add_watcher_and_build(\n  builder,\n  targets=[\n    (\"system_name\", \"port_name\"),\n    \"system_name2\",\n  ],\n)\n```\nThe above code tells the watcher to watch the port named `port_name` on the system named `system_name`.\n(If you don't know your system's name in Drake, then you can usually find it by using the `get_name()` method.)\n\n## FAQs\n\n### Why the name Brom?\n\n[Brom the storyteller](https://inheritance.fandom.com/wiki/Brom) is a character from the\n[Inheritance](https://en.wikipedia.org/wiki/Eragon) series by Christopher Paolini.\nHe is a wise mentor that helps Eragon (the protagonist) master dragons. ;)\n\n \n\n## Related Work\n\nSome other work in the open-source drake community:\n- [kinova_drake](https://github.com/vincekurtz/kinova_drake) - A Drake-based library that builds a \n  simple version of the manipulation station for the Kinova Gen3 robot arm.\n  Also works with the hardware.\n- [airo-drake](https://github.com/airo-ugent/airo-drake) - A python package meant to simplify\n  working with Drake and the `airo-mono` repository from the AI and Robotics Lab at Ghent University.\n\n## To-Dos\n\n- [ ] Figure out how to tell if two systems are connected in Drake.\n- [x] Demonstrate how to create a simple Vector logger for the\n  tutorial's diagram.\n  - [x] Determine if we can use `DiagramTarget` objects to do everything (assuming that they are all valid). i.e., with the name and the port # can we do waht we want?\n- [ ] Add more examples\n- [x] Add Code coverage\n- [ ] Add support for abstract output ports?\n- [ ] Add more readme explanations of what is going on under the hood.\n- [ ] Add support for giving `DiagramTarget` (or simpler objects) to the convenience functions.\n- [x] Add to PyPI\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A set of convenient logging and testing tools for the Drake robotics toolbox.",
    "version": "0.1.1",
    "project_urls": null,
    "split_keywords": [
        "drake",
        " robotics",
        " testing",
        " logging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8106999868b78693970e892b60ffbb24a1d5b522ecdef2d537954be7c0b3b93f",
                "md5": "50c61e8d890fcfed85f8853a988470b9",
                "sha256": "4c62ac4525cfcaba5002cb9fb9e752fe3b01672184ed6c3f3e838cd97d93d1df"
            },
            "downloads": -1,
            "filename": "brom_drake-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "50c61e8d890fcfed85f8853a988470b9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 13352,
            "upload_time": "2024-04-26T21:10:02",
            "upload_time_iso_8601": "2024-04-26T21:10:02.142812Z",
            "url": "https://files.pythonhosted.org/packages/81/06/999868b78693970e892b60ffbb24a1d5b522ecdef2d537954be7c0b3b93f/brom_drake-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7eb3a692a120d43222de4453ea8bef175866fb8b43b77513edaabaa4e974f90a",
                "md5": "578c0ab03287aad6621c900f57d9a539",
                "sha256": "ab92b22eaabc93f11f53b389753213980975545206f74ecde321fb603e6d9ec4"
            },
            "downloads": -1,
            "filename": "brom_drake-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "578c0ab03287aad6621c900f57d9a539",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12655,
            "upload_time": "2024-04-26T21:10:03",
            "upload_time_iso_8601": "2024-04-26T21:10:03.377381Z",
            "url": "https://files.pythonhosted.org/packages/7e/b3/a692a120d43222de4453ea8bef175866fb8b43b77513edaabaa4e974f90a/brom_drake-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-26 21:10:03",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "brom-drake"
}
        
Elapsed time: 0.23222s