forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
primitives: Remove templates from RandomSource APIs (RobotLocomotion#…
…11670) Templates make compilation times long and error messages bad.
- Loading branch information
1 parent
c6f0525
commit 12a8432
Showing
9 changed files
with
273 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# See `ExecuteExtraPythonCode` in `pydrake_pybind.h` for usage details and | ||
# rationale. | ||
|
||
import warnings | ||
|
||
|
||
_DEPRECATION_MESSAGE = ( | ||
"Use primitives.RandomSource(RandomDistribution.kFoo, ...) instead of " + | ||
"primitives.FooRandomSource. This class will be removed on 2019-10-01.") | ||
|
||
|
||
def UniformRandomSource(num_outputs, sampling_interval_sec): | ||
"""Deprecated constructor that desugars to | ||
primitives.RandomSource(RandomDistribution.kUniform, **args, **kwargs). | ||
This constructor will be removed on 2019-10-01.""" | ||
from pydrake.common import RandomDistribution | ||
from pydrake.common.deprecation import DrakeDeprecationWarning | ||
from pydrake.systems.primitives import RandomSource | ||
warnings.warn(_DEPRECATION_MESSAGE, category=DrakeDeprecationWarning, | ||
stacklevel=2) | ||
return RandomSource( | ||
distribution=RandomDistribution.kUniform, | ||
num_outputs=num_outputs, | ||
sampling_interval_sec=sampling_interval_sec) | ||
|
||
|
||
def GaussianRandomSource(num_outputs, sampling_interval_sec): | ||
"""Deprecated constructor that desugars to | ||
primitives.RandomSource(RandomDistribution.kGaussian, **args, **kwargs). | ||
This constructor will be removed on 2019-10-01.""" | ||
from pydrake.common import RandomDistribution | ||
from pydrake.common.deprecation import DrakeDeprecationWarning | ||
from pydrake.systems.primitives import RandomSource | ||
warnings.warn(_DEPRECATION_MESSAGE, category=DrakeDeprecationWarning, | ||
stacklevel=2) | ||
return RandomSource( | ||
distribution=RandomDistribution.kGaussian, | ||
num_outputs=num_outputs, | ||
sampling_interval_sec=sampling_interval_sec) | ||
|
||
|
||
def ExponentialRandomSource(num_outputs, sampling_interval_sec): | ||
"""Deprecated constructor that desugars to | ||
primitives.RandomSource(RandomDistribution.kExponential, **args, **kwargs). | ||
This constructor will be removed on 2019-10-01.""" | ||
from pydrake.common import RandomDistribution | ||
from pydrake.common.deprecation import DrakeDeprecationWarning | ||
from pydrake.systems.primitives import RandomSource | ||
warnings.warn(_DEPRECATION_MESSAGE, category=DrakeDeprecationWarning, | ||
stacklevel=2) | ||
return RandomSource( | ||
distribution=RandomDistribution.kExponential, | ||
num_outputs=num_outputs, | ||
sampling_interval_sec=sampling_interval_sec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.