In this demo of my cartpole environment, use the A/D letters or </> keys on your keyboard to control the cart. This is as simple as it can get for a cart pole environment! Yay, so minimalistic. To use the environment, broadcast "Initialize" at the very start to set up all of the variables (according to the public variables labeled "Initial"). Then, during every loop, broadcast "Step" to run the physics simulation by 1 step. (By the way, you can set the step size [in seconds] using the public variable.) To access the current state of the pole and cart from another sprite (pole angle, cart velocity etc.), you can access the public variables labeled "Output". To control the cart (which is just basically pushing it left or right) from another sprite, just use the public "Input (-1/0/1)" variable. Set it to -1 for leftward force, 0 for neutral, and 1 for rightward force. Finally, you can set the parameters, like cart mass, to whatever you want! To do that, click see inside, and set the variables labeled "Settings:" to whatever you want in your own spite. (Currently in this demo project, you have to go in my Demo sprite to set the variables. They are labeled "Settings:", and you can just backspace the current values, type in the new values you want.) That's it! Sorry that there is no user interface to set these parameters. But hey, the whole point of this project was to make it simple! #cartpole #cart-pole #physics
If you are going to use this physics environment, feel free! Just credit me. Thanks. The very simple code was by me, but this was heavily inspired by the cartpole environment from gym (for AI trAIning). You can clearly tell that by seeing the colors I chose for the cart, pole and the joint. Exactly the same as the original environment! lol. By the way, the reason why I didn't just make the environment variables public is because I don't want another sprite interfering with the simulation output, so no matter what the other sprites do to the public output variables (the ones labeled "Output"), the simulation doesn't care. If you want to know which variables are private, all of the private variables are prefixed with an underscore, and what "private" means is that they can only be accessed from within the sprite is was created in.