-
-
Notifications
You must be signed in to change notification settings - Fork 255
ENH: Discrete and Continuous Controllers #946
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
base: develop
Are you sure you want to change the base?
Changes from all commits
be42228
6f11c5e
31d80b9
3c28452
a4de476
a990a8b
77bfd81
df331fa
ccce75d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2002,6 +2002,50 @@ def add_thrust_eccentricity(self, x, y): | |
| self.thrust_eccentricity_y = y | ||
| return self | ||
|
|
||
| def add_discrete_controller( | ||
| self, | ||
| controller_function, | ||
| refresh_rate, | ||
| interactive_objects=None, | ||
| initial_observed_variables=None, | ||
| name="Controller", | ||
| ): | ||
|
Malmahrouqi3 marked this conversation as resolved.
|
||
| """Creates a new discrete controller, storing its parameters such as | ||
| controller function, refresh rate, and interactive objects. The controller | ||
| will be called at the specified refresh rate during the simulation.""" | ||
|
|
||
| controller = _Controller( | ||
| controller_function=controller_function, | ||
| sampling_rate=refresh_rate, | ||
| interactive_objects=interactive_objects, | ||
| initial_observed_variables=initial_observed_variables, | ||
| name=name, | ||
| ) | ||
|
Malmahrouqi3 marked this conversation as resolved.
|
||
|
|
||
| self._add_controllers(controller) | ||
|
Malmahrouqi3 marked this conversation as resolved.
|
||
|
|
||
| def add_continuous_controller( | ||
| self, | ||
| controller_function, | ||
| interactive_objects=None, | ||
| initial_observed_variables=None, | ||
| name="Controller", | ||
| ): | ||
| """Creates a new continuous controller, storing its parameters such as | ||
| controller function and interactive objects. The controller will | ||
| be called at every time step of the simulation.""" | ||
|
|
||
| controller = _Controller( | ||
| controller_function=controller_function, | ||
| sampling_rate=math.inf, | ||
| interactive_objects=interactive_objects, | ||
| initial_observed_variables=initial_observed_variables, | ||
| name=name, | ||
| ) | ||
|
|
||
| self._add_controllers(controller) | ||
| return controller | ||
|
Comment on lines
+2005
to
+2047
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because controllers are still an experimental feature, I´d prefer to only have |
||
|
|
||
| def draw(self, vis_args=None, plane="xz", *, filename=None): | ||
| """Draws the rocket in a matplotlib figure. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason for using
math.infhere? I think usingNoneto indicate a continuous signal is cleaner and safer. It prevents sampling_rate from being mistakenly evaluated as a number when it doesn't have a meaningful value