Skip to content

How to modify configuration at reset in the gym environment? #63

Discussion options

You must be logged in to vote

The best way is to pass the initial orientation to the spine via the configuration dictionary. The orientation part was indeed not wired 😉 This is now fixed with upkie/vulp#33, so that we can write examples such as this one:

"""Genuflect while lying on a horizontal floor."""

import gym
import numpy as np
from loop_rate_limiters import RateLimiter

import upkie.envs

nb_genuflections = 10
genuflection_steps = 200
amplitude = 1.0  # in radians

config = {
    "bullet": {
        "orientation_init_base_in_world": [0.707, 0.0, -0.707, 0.0],  # [qw, qx, qy, qz]
        "position_init_base_in_world": [0.0, 0.0, 0.1],  # [x, y, z]
    }
}

if __name__ == "__main__":
    upkie.envs.register()
    

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by stephane-caron
Comment options

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

@perrin-isir
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #61 on June 06, 2023 14:39.