You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One way would be for for pos in ocp('pos')
to loop over timestep, degIdx, intermediateControlIdx for pos in ocp('pos',timestep=5)
to loop over degIdx, intermediateControlIdx
etc
Maybe it would be easier to just have ocp('pos') to return an ndarray that the user could slice manually. But even then, some variables are undefined at some nodes, for example algebraic variables are undefined at degIdx=0, nothing is defined at timestep=N except differential states, nothing at all is defined for timestepN, degIdx>0 or intermediateControlIdx>0
This is not so simple to handle generally but also intuitively for the user. Maybe this functionality should be pushed into a higher level Ocp class.
It would be nice if the collocation class had a built-in iterator that returns the variable over the whole range...
i.e. instead of something like:
obj = 0
for k in range(N):
for j in range(ocp.deg+1):
obj += ocp('abspos',timestep=k,degIdx=j)
obj += ocp('abspos',timestep=N,degIdx=0)
user does something like:
obj = 0
for abspos in ocp.timeIteratorForVariable('abspos'):
obj += abspos
or maybe ocp.iterValueForAllTimes('abspos')
perhaps the time should be returned too, i.e.:
obj = 0
for (abspos,t) in ocp.timeIteratorForVariable('abspos'):
obj += someTimeVaryingFunction(abspos,t)
The text was updated successfully, but these errors were encountered: