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() |
|
The Drake-ify feature (converts your URDF file into a form that Drake can consume) | drakeify_my_urdf() |
|
Scenes (partially complete robot scenarios to test your algorithms) | (See Examples Directory or the Wiki) |
(More coming soon...)
brom_drake
is available on PyPI and installable with pip:
pip install brom-drake
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 .
Here are a few of the features available in brom_drake
and how they work.
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:
DiagramWatcher
will be created.
DiagramBuilder
has added.VectorLogger
to each output port that is a kVectorValued
port.DiagramWatcher
will connect all loggers to all targeted ports (in the above case, we will target all available output ports)..png
files. These plots will be in a new .brom
directory.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.)
Feel free to cite this project if it helped with your work!
@misc{drake,
author = "Kwesi Rutledge and the Wrench Robotics Team",
title = "Brom: A Helper Library for the Drake Toolbox",
year = 2024,
}
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. ;)
Some other work in the open-source drake community:
airo-mono
repository from the AI and Robotics Lab at Ghent University.ShowMeThisModel
scene