-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
py systems: DiagramBuilder.AddSystem()
may not propagate existing keep-alive "edges"
#14355
Comments
Also, Russ pointed out that this is probably an issue with LCM systems in Python too. And now that I look, it appears that I worked around this in Anzu code too 🤦 (this was in mid-June 2020) # TODO(eric.cousineau): Keep alive fixes:
# - https://github.com/robotlocomotion/drake/pull/13075 - didn't work :(
# - InverseDynamicsController - doesn't keep control plant alive
_keep_alive = []
...
def build_arm_control(
builder,
plant,
arm_instance,
*,
kp=np.array([2000., 1500, 1500, 1500, 1500, 500, 500]),
kd=None,
use_velocity_control=True,
time_step=0.005,
):
...
control_plant, _ = make_control_model(plant, [arm_instance])
# TODO(eric.cousineau): Remove the need for `_keep_alive` hack.
_keep_alive.append(control_plant)
...
controller = builder.AddSystem(InverseDynamicsController(
robot=control_plant, kp=kp, ki=ki, kd=kd,
has_reference_acceleration=False))
... |
Thanks @EricCousineau-TRI . I'm not sure it's that much of an edge case. It seems that any time I'm hoping for ownership for a system that is pushed through |
It might happen often, yup! And to modify your statement: |
This is one of the "ownership trees" that Jeremy mentioned should be documented: #13058 |
This is a workaround to ensure we propagate keep_alive relationships Resolves RobotLocomotion#14355
This is a workaround to ensure we propagate keep_alive relationships Resolves RobotLocomotion#14355
This is a workaround to ensure we propagate keep_alive relationships Resolves RobotLocomotion#14355
This is a workaround to ensure we propagate keep_alive relationships Resolves #14355
See Slack convo:
https://drakedevelopers.slack.com/archives/C3YB3EV5W/p1605703451063400
Currently, we have this for
DiagramBuilder.AddSystem
(which is locally correct):drake/bindings/pydrake/systems/framework_py_semantics.cc
Lines 454 to 461 in 6d56ea0
But @RussTedrake ran into an edge case where the following code would segfault without the workaround to keep
controller_plant
alive:https://github.com/RussTedrake/manipulation/blob/805d4c582268b3803e90125266803e13dbc9ddbc/manipulation_station.ipynb
This
keep_alive
on the ID looks fine:drake/bindings/pydrake/systems/controllers_py.cc
Line 95 in 6d56ea0
But most likely, the
PyObject
for theInverseDynamics
evaporates since it's inside theMakeManipulationStation()
function, so thekeep_alive
"graph" evaporates, so nothing is there to keep thecontroller_plant
alive.Hack solution is to just add a reference cycle for now, and reap the issues later :(
Something like:
\cc @SeanCurtis-TRI
The text was updated successfully, but these errors were encountered: