Rapid-Design-of-Systems-Laboratory / beluga

General purpose indirect trajectory optimization
Other
25 stars 6 forks source link

Errors when trying to use direct method to solve the orbit raising problem #222

Closed HanaeLab closed 3 years ago

HanaeLab commented 4 years ago

When trying to use collocation to solve a DIRECT optimization problem for the orbit raising example, I faced a "KeyError : 'name'". This is the code I added to the example :

beluga.solve(ocp=ocp, method='direct', bvp_algorithm=bvp_solver_collocation, steps=continuation_steps, guess_generator=guess_maker, autoscale=False, save='direct_data.blg')

and this is the error I got :

`runfile('D:/Documents/exemple_orbitRaising.py', wdir='D:/Documents') Traceback (most recent call last):

File "", line 1, in runfile('D:/Documents/exemple_orbitRaising.py', wdir='D:/Documents')

File "c:\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile execfile(filename, namespace)

File "c:\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/Documents/exemple_orbitRaising.py", line 117, in save='direct_data.blg')

File "c:\anaconda3\lib\site-packages\beluga\beluga.py", line 305, in solve bvp, ocp_map, ocp_map_inverse = ocp2bvp(ocp, method=method, optim_options=optim_options)

File "c:\anaconda3\lib\site-packages\beluga\beluga.py", line 88, in ocp2bvp bvp_raw, _map, _map_inverse = DIRECT_ocp_to_bvp(ocp, **optim_options)

File "c:\anaconda3\lib\site-packages\beluga\optimlib\direct.py", line 13, in ocp_to_bvp ws = init_workspace(ocp)

File "c:\anaconda3\lib\site-packages\beluga\optimlib\optimlib.py", line 543, in init_workspace workspace['switches'] += [sympify(q['name'])]

KeyError: 'name' `

I am using Python 3.7.3

SeanMatthewNolan commented 4 years ago

@HanaeLab Thank you for letting us know about this issue. Eventually, we will try to get the direct components of beluga functional again, but I expect that may take some time as our focus is on the indirect side. If you need a direct solver specifically in the near term, I suggest looking at OpenGoddard.

HanaeLab commented 4 years ago

@SeanMatthewNolan thank you for your answer ! I will follow your advice.

SeanMatthewNolan commented 3 years ago

I'm closing this for now. I will reopen it if we decide to reimplement direct methods into beluga.