A set of convenient logging and testing tools for the Drake robotics toolbox.
Project description
brom_drake-py
Brom is a helper library for the Drake 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() |
(More coming soon...)
Installation
brom_drake
is available on PyPI and installable with pip:
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:
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.
# 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 akVectorValued
port. - The
DiagramWatcher
will connect all loggers to all targeted ports (in the above case, we will target all available output ports).
- It will search through all systems that the
- 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:
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 is a character from the Inheritance 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 - 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 - 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.
- Demonstrate how to create a simple Vector logger for the
tutorial's diagram.
- 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?
- Determine if we can use
- Add more examples
- 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. - Add to PyPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file brom_drake-0.1.4.tar.gz
.
File metadata
- Download URL: brom_drake-0.1.4.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af32a6aa593aa483f4e69f6f2d58a5483f684949c501c23681ad6952005270de |
|
MD5 | cb4938dd0c74b31c62fb49845988b853 |
|
BLAKE2b-256 | d6647f7c471b8eeabfd4f869cf2df04e60154a4a8381db5507c35f150fdda156 |
File details
Details for the file brom_drake-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: brom_drake-0.1.4-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f14f79ce51046bd8a820d979c82f17dad2459b7c9e90acc334c372d8a4f0f717 |
|
MD5 | dc5f42785cde309143077d180d2ce844 |
|
BLAKE2b-256 | c8986ff2bab6e0cac0e5140836f253ed2f1004052b61bb1476a35f20b7d1b62e |