问题
I'd like to set up trajectory optimization for the compass gait system (as hinted in the lecture video, using control authority can expand the region of attraction for stable walking).
In trying to use the DirectTranscription
class on compass gait, I am running into the following issue:
plant = CompassGait()
context = plant.CreateDefaultContext()
DirectTranscription(plant, context, 21, TimeStep(0.01))
results in the following error:
An exception has occurred, use %tb to see the full traceback.
SystemExit: Failure at bazel-out/k8-opt/bin/systems/framework/_virtual_includes/context/drake/systems/framework/context.h:111 in num_total_states(): condition 'num_abstract_states() == 0' failed.
Is there a quick workaround for this issue? In looking at the compass gait implementation, the abstract state is only used for visualization. In principle, I could make a copy of the compass gait implementation and comment out the abstract state. But I'm using the colab notebook environment so I'm not sure how to easily do this.
Thanks!
回答1:
The DirectCollocation
implementation has an option, assume_non_continuous_states_are_fixed
which gets around this issue for the rimless wheel example I have here: http://underactuated.mit.edu/contact.html
I'll try to push this feature into DirectTranscription
shortly. But you should be able to use DirectCollocation
immediately. Does that work?
来源:https://stackoverflow.com/questions/61212887/direct-transcription-for-compass-gait