Skip to content
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

Figure out pendulum dynamics #27

Open
declanoller opened this issue Nov 15, 2019 · 2 comments
Open

Figure out pendulum dynamics #27

declanoller opened this issue Nov 15, 2019 · 2 comments
Labels

Comments

@declanoller
Copy link
Collaborator

Doesn't actually need to match Pendulum-v0, but they need to be able to simulate the non-hardware version of Pendulum-raas and expect that it'll work about the same when they use it with the hardware version.

This involves setting the torque, making sure the velocity is in a reasonable range, etc.

@declanoller
Copy link
Collaborator Author

Some updates:

I did a test to get a sense of the power of the torque. To do this, I ran const_tests.py in the raas-experiments repo, which basically sets the torque, waits a second for it to normalize, then takes the observation at that angle, sweeping through ranges [-2, 2] and then [2, -2].

The first thing is that we can see it has some hysteresis:

torque_ang_hysteresis

Also looking at it, you can see (in long flat regions) that it probably has lots of static friction, which I'm guessing is causing the hysteresis.

This may not be a huge deal, hysteresis probably won't matter when it's swinging around a bunch. But it could make it a bit tricky to match our simulation version to.

the other thing to thing about is the angle. In openAI gym's Pendulum env, the upright angle (i.e., the goal) is theta = 0, and the position when it's down is -pi and pi. Our motor controller by default sets the down (i.e., hanging with no torque) position.

So our motor_controller.py has angles: down = 0/2pi, increase to top = pi. To make this equivalent with openAI gym, which has: down = -pi/pi, increase to top = 0, I think it should make sense to just say theta = theta_motor - np.pi. So I've edited PendulumEnv.py to reflect that, but someone check my math.

@philzook58
Copy link
Collaborator

philzook58 commented Jul 23, 2020

We calculated the dynamics from the spec of the motors, however they only have "rated torque" which is a technical term for continuously deliverable torque at rated speed. We probably care more about stall torque which is a larger number.
Declan has some new measurements that approximate the appropriate torque number at ~ 10x the calculation based on "rated torque"

These are resonance curves

angles_vs_torques (1)
image (4)
image (5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants