-
Notifications
You must be signed in to change notification settings - Fork 20
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
two link pendulum to be uprighted using opty with variable h #178
Conversation
Congrats on making the pull request! This looks very good but will need some tweaks before we merge it. I see that you edited the master branch of your clone. It is best to make a new branch (from master) with a unique name and then make the PR from that branch. This is important, for example, when I clone your PR branch so it does not conflict with my local master branch. |
The thumbnail doesn't seem to be selected with the right number: See https://sphinx-gallery.github.io/stable/auto_examples/plot_4_choose_thumbnail.html for more info. |
The file name needs to be named in this fashion:
i.e. start with |
When I ran this the first solve gives:
So an optimal solution is found in the first call to solve. That is all you need for this example, otherwise it takes too long. It took 22 seconds for 1161 iterations, which is ok time wise. |
Should I remove the loop, or just run through it once? |
Remove the loop. For these "simple" examples, we should keep them short and simple (both in code length and in run time). If an optimal solution is found with one call to |
In my ipynb files, if I add the line it does give the animation. |
display(HTML(anim.to_jshtml())) is not needed here, you have to follow the instruction in the sphinx-gallery documentation and/or copy exactly how I do the other examples files that start with |
Do I understand this correctly:
|
You make a single fork on github of the opty repository: makes a copy of this repo under your github account name You then clone your fork to your PC using git. You then create a new branch Make edits to the code or add new files using When happy with changes push your new branch to your fork on github: Github will then say "would you like to make a PR?" (if it is the first push). Make the PR (which is what we we now have here). Then we review your code and you have to make changes. Locally your edit the file(s) in the same branch "my-new-example". Then when happy you |
The fork and the clone on my PC I already have , otherwise I could not have done, what I have been doing so far. Correct? |
This should be a well behaved problem. It isn't so complex. I think choosing the right # of nodes and an good initial guess is needed. For example I set num_nodes=400 and initial guess:
and I got:
This gives a 2.84 second swing up and very smooth bang bang input. |
I guess because I am retired and I have time, I never put much emphasis on the speed. :-) |
The speed matters for these examples because we run the automated building on Github's computers which they let use use for free up to limits. One of the limits is the length of computation time. It's best if we keep the examples simple and lean so we can add lots of them. |
with these initial conditions I got thes results:
similar to yours. |
Let's stick with the ~2.84 second colution and if it takes 30 seconds to find we can merge it for now. It think a better initial guess would be zeros for everything except: q2 & q3 as a linear function from initial value to final value, h as the expected ~0.01 and that might make it a bit faster to find it. |
Understood. I did not know this. |
I will try this tomorrow morning. |
All of the figures and animation work expect for the last frame, which I explained why above. |
Hi Peter, I added the linear initial guess and it solves very quickly. Merging! Congrats on the PR! You can see the result here: https://opty.readthedocs.io/latest/examples/plot_two_link_pendulum_on_a_cart.html If you want to tweak it more, open a new PR with edits to the example. |
Also see that you are now a contributor: https://github.com/csu-hmc/opty/graphs/contributors |
I must admit, that I am a bit proud of this! :-) |
Don't delete anything. You only need to make a fork once (copy of this repo to your github account) and keep that forever. Also you only need to clone once to your PC. |
|
I have never seen that delivered as a message, but it is a screen in the settings of a repository. Do not delete anything. |
Clear, thanks! Sorry about the confusion! |
I have prepared my new optimization to the requirements of example-gallery to the best of my ability. I want to call it plot_sliding_block
|
Yes.
yes, but it also depends on the state of your git repo. I would do this:
to check what branch i'm on. If on master, then you need to pull in the changes from the main repository:
but
Now:
This updates your local master branch with changes in the main repo's master branch. Now you create a new branch for you new example:
Add any files with When ready you push the branch to your fork:
and you can open a PR. |
This is a full lesson explaining the basics of git commands: https://swcarpentry.github.io/git-novice/03-create.html |
GREAT set of instructions!! |
Yes. |
Already stuck! :-( my clone is called opty and has this path |
Google the error message. |
I need git init first, but still not working right. |
You are not in the correct directory in BASH. I recommend doing these two lessons (in full and in order): https://swcarpentry.github.io/shell-novice/ https://swcarpentry.github.io/git-novice/ There are even videos online: https://www.youtube.com/watch?v=U3iNcBtycaQ&list=PLUQy4zfrctjH-FsjpIZDZ0NBznvF4FdNP |
I watched the first video once and started with the second. Frustrating how little I know! |
A two linked pendulum is attached to a cart which can move in the horizontal (X axis) direction). A force may be applied to the cart. The goal is to get the pendulum into an upright position as fast as possible, by moving the cart left / right. The absolute value of the force is limited.