Skip to content

How can I get started using the UpkieGroundVelocity environment? #15

Discussion options

You must be logged in to vote

Here is a simple example (edit: updated to Upkie 3.4.0):

import gymnasium as gym
import upkie.envs

upkie.envs.register()

if __name__ == "__main__":
    env = gym.make("UpkieGroundVelocity-v3")
    observation = env.reset(seed=42)

    action = env.action_space.sample()
    for step in range(1_000_000):
        observation, reward, done, _, _ = env.step(action)
        if done:
            observation = env.reset()
        pitch = observation[0]
        action[0] = 10.0 * pitch

    env.close()

Start the pi3hat/simulation spine in a separate process before running this script:

$ ./tools/bazelisk run //spines:bullet -c opt -- --nb-substeps 5 --show

Otherwise the script will let you know t…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@stephane-caron
Comment options

@stephane-caron
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by stephane-caron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant