Initial joints configuration #427
-
Hello, I use the bullet spine and I tried to change the initial positions of the joints via RobotState but it does not work. Also, self.joint_configuration does not seem to intervene anywhere in the RobotState class, and I have not found out how to set initial joints positions yet. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Now yes 😃 The initial joint configuration was exposed on the Python side, but not handled by the Bullet C++ spine as discussed here. It has now been added in #428 and released with v5.2.0. For instance: import gymnasium as gym
import numpy as np
from scipy.spatial.transform import Rotation as ScipyRotation
import upkie.envs
from upkie.utils.robot_state import RobotState
if __name__ == "__main__":
upkie.envs.register()
with gym.make(
"UpkieServoPositions-v4",
frequency=200.0,
init_state=RobotState(
orientation_base_in_world=ScipyRotation.from_quat(
[0.0, 0.0, -0.707, 0.707], # SciPy convention: (x, y, z, w))
),
position_base_in_world=np.array([0.1, 0.0, 0.7]),
joint_configuration=np.array([1.0, 2.0, 3.0, 0.0, 0.0, 0.0]),
),
) as env:
for step in range(10_000):
env.reset() # keep resetting to show the initial state will keep the robot in the air with a raised left leg (first three joint angles) and a straight right leg (next three joint angles to zero). Hoping this helps! |
Beta Was this translation helpful? Give feedback.
Now yes 😃 The initial joint configuration was exposed on the Python side, but not handled by the Bullet C++ spine as discussed here. It has now been added in #428 and released with v5.2.0. For instance: