Takes initial [x, v, θ, ω] and sequence of actions
Simulates CartPole dynamics using Euler integration
Returns trajectory of (state, reward) pairs
Done when |x| > 2.4 or |θ| > π/12
Constraints
Physics parameters from OpenAI Gym CartPole-v0
Force = 10 N
Gravity = 9.8 m/s^2
Pole length = 0.5 m, mass = 0.1 kg
Cart mass = 1.0 kg
Hints
Hint 1: State transition
Use equations of motion for inverted pendulum on cart
Hint 2: Done condition
Episode ends if x > 2.4 or θ > π/12
Hint 3: Rewards
+1 per step while balanced, 0 when done
Keywords
rlcontrolsimulationapplications
Python
Run your code to see results
No results yet
Run your code to check it against the examples, or submit to run every test.