@@ -54,8 +54,59 @@ class FlatSystem(NonlinearIOSystem):
54
54
"""Base class for representing a differentially flat system.
55
55
56
56
The FlatSystem class is used as a base class to describe differentially
57
- flat systems for trajectory generation. The class must implement two
58
- functions:
57
+ flat systems for trajectory generation. The output of the system does not
58
+ need to be the differentially flat output.
59
+
60
+ Parameters
61
+ ----------
62
+ forward : callable
63
+ A function to compute the flat flag given the states and input.
64
+ reverse : callable
65
+ A function to compute the states and input given the flat flag.
66
+ updfcn : callable, optional
67
+ Function returning the state update function
68
+
69
+ `updfcn(t, x, u[, param]) -> array`
70
+
71
+ where `x` is a 1-D array with shape (nstates,), `u` is a 1-D array
72
+ with shape (ninputs,), `t` is a float representing the currrent
73
+ time, and `param` is an optional dict containing the values of
74
+ parameters used by the function. If not specified, the state
75
+ space update will be computed using the flat system coordinates.
76
+ outfcn : callable
77
+ Function returning the output at the given state
78
+
79
+ `outfcn(t, x, u[, param]) -> array`
80
+
81
+ where the arguments are the same as for `upfcn`. If not
82
+ specified, the output will be the flat outputs.
83
+ inputs : int, list of str, or None
84
+ Description of the system inputs. This can be given as an integer
85
+ count or as a list of strings that name the individual signals.
86
+ If an integer count is specified, the names of the signal will be
87
+ of the form `s[i]` (where `s` is one of `u`, `y`, or `x`). If
88
+ this parameter is not given or given as `None`, the relevant
89
+ quantity will be determined when possible based on other
90
+ information provided to functions using the system.
91
+ outputs : int, list of str, or None
92
+ Description of the system outputs. Same format as `inputs`.
93
+ states : int, list of str, or None
94
+ Description of the system states. Same format as `inputs`.
95
+ dt : None, True or float, optional
96
+ System timebase. None (default) indicates continuous
97
+ time, True indicates discrete time with undefined sampling
98
+ time, positive number is discrete time with specified
99
+ sampling time.
100
+ params : dict, optional
101
+ Parameter values for the systems. Passed to the evaluation
102
+ functions for the system as default values, overriding internal
103
+ defaults.
104
+ name : string, optional
105
+ System name (used for specifying signals)
106
+
107
+ Notes
108
+ -----
109
+ The class must implement two functions:
59
110
60
111
zflag = flatsys.foward(x, u)
61
112
This function computes the flag (derivatives) of the flat output.
@@ -83,65 +134,13 @@ def __init__(self,
83
134
updfcn = None , outfcn = None , # I/O system
84
135
inputs = None , outputs = None ,
85
136
states = None , params = {}, dt = None , name = None ):
86
- """Create a differentially flat input/output system.
137
+ """Create a differentially flat I/O system.
87
138
88
139
The FlatIOSystem constructor is used to create an input/output system
89
- object that also represents a differentially flat system. The output
90
- of the system does not need to be the differentially flat output.
91
-
92
- Parameters
93
- ----------
94
- forward : callable
95
- A function to compute the flat flag given the states and input.
96
- reverse : callable
97
- A function to compute the states and input given the flat flag.
98
- updfcn : callable, optional
99
- Function returning the state update function
100
-
101
- `updfcn(t, x, u[, param]) -> array`
102
-
103
- where `x` is a 1-D array with shape (nstates,), `u` is a 1-D array
104
- with shape (ninputs,), `t` is a float representing the currrent
105
- time, and `param` is an optional dict containing the values of
106
- parameters used by the function. If not specified, the state
107
- space update will be computed using the flat system coordinates.
108
- outfcn : callable
109
- Function returning the output at the given state
110
-
111
- `outfcn(t, x, u[, param]) -> array`
112
-
113
- where the arguments are the same as for `upfcn`. If not
114
- specified, the output will be the flat outputs.
115
- inputs : int, list of str, or None
116
- Description of the system inputs. This can be given as an integer
117
- count or as a list of strings that name the individual signals.
118
- If an integer count is specified, the names of the signal will be
119
- of the form `s[i]` (where `s` is one of `u`, `y`, or `x`). If
120
- this parameter is not given or given as `None`, the relevant
121
- quantity will be determined when possible based on other
122
- information provided to functions using the system.
123
- outputs : int, list of str, or None
124
- Description of the system outputs. Same format as `inputs`.
125
- states : int, list of str, or None
126
- Description of the system states. Same format as `inputs`.
127
- dt : None, True or float, optional
128
- System timebase. None (default) indicates continuous
129
- time, True indicates discrete time with undefined sampling
130
- time, positive number is discrete time with specified
131
- sampling time.
132
- params : dict, optional
133
- Parameter values for the systems. Passed to the evaluation
134
- functions for the system as default values, overriding internal
135
- defaults.
136
- name : string, optional
137
- System name (used for specifying signals)
138
-
139
- Returns
140
- -------
141
- InputOutputSystem
142
- Input/output system object
140
+ object that also represents a differentially flat system.
143
141
144
142
"""
143
+
145
144
# TODO: specify default update and output functions
146
145
if updfcn is None : updfcn = self ._flat_updfcn
147
146
if outfcn is None : outfcn = self ._flat_outfcn
@@ -158,6 +157,7 @@ def __init__(self,
158
157
# Save the length of the flat flag
159
158
160
159
def forward (self , x , u , params = {}):
160
+
161
161
"""Compute the flat flag given the states and input.
162
162
163
163
Given the states and inputs for a system, compute the flat
0 commit comments