* Constructor of CartPole.
()
| 41 | * Constructor of CartPole. |
| 42 | */ |
| 43 | constructor() { |
| 44 | // Constants that characterize the system. |
| 45 | this.gravity = 9.8; |
| 46 | this.massCart = 1.0; |
| 47 | this.massPole = 0.1; |
| 48 | this.totalMass = this.massCart + this.massPole; |
| 49 | this.cartWidth = 0.2; |
| 50 | this.cartHeight = 0.1; |
| 51 | this.length = 0.5; |
| 52 | this.poleMoment = this.massPole * this.length; |
| 53 | this.forceMag = 10.0; |
| 54 | this.tau = 0.02; // Seconds between state updates. |
| 55 | |
| 56 | // Threshold values, beyond which a simulation will be marked as failed. |
| 57 | this.xThreshold = 2.4; |
| 58 | this.thetaThreshold = 12 / 360 * 2 * Math.PI; |
| 59 | |
| 60 | this.setRandomState(); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Set the state of the cart-pole system randomly. |
nothing calls this directly
no test coverage detected