0

When my program throws an algebraic loop error such as one below

terminate called after throwing an instance of 'std::runtime_error'
  what():  Algebraic loop detected in DiagramBuilder:
  A depends on
  B depends on
  C depends on
  D depends on
  E
Aborted (core dumped)

Does it mean I have the following loop

A --> B --> C --> D --> E --> A

or is it only saying that the loop is detected at E (and A to D are just some additional context), i.e.

A --> B --> C --> D --> E --> (any one of A to D)

Because there is absolutely no way the value of A is affected by the value of E in my system...

Rufus
  • 5,111
  • 4
  • 28
  • 45

1 Answers1

0

It's hard to know given your abstract system names, but the algebraic loop checking logic is here:

https://github.com/RobotLocomotion/drake/blob/2b275fc6dd4c60ef72c9f4fa1d643a261e38125f/systems/framework/diagram_builder.h#L225

If your circular dependency in the diagram is real (as it is in any feedback loop), then you have to make sure that at least one of the nodes in the cycle is not "direct feedthrough". Note that most diagrams with feedback break the algebraic loop by having a plant with state (the output depends on the state, not directly on the input).

Russ Tedrake
  • 4,703
  • 1
  • 7
  • 10