Upload folder using huggingface_hub
Browse files- code/snow_rl/snow_env.py +6 -1
code/snow_rl/snow_env.py
CHANGED
|
@@ -148,7 +148,12 @@ class SnowJoystick(joystick.Joystick):
|
|
| 148 |
if slope != 0.0:
|
| 149 |
# Rotate gravity about +y: the robot walking along +x is then walking uphill.
|
| 150 |
g = float(np.linalg.norm(self._mj_model.opt.gravity))
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
self._mj_model.opt.gravity[:] = tilted
|
| 153 |
self._mjx_model = self._mjx_model.replace(opt=self._mjx_model.opt.replace(
|
| 154 |
gravity=jnp.asarray(tilted)))
|
|
|
|
| 148 |
if slope != 0.0:
|
| 149 |
# Rotate gravity about +y: the robot walking along +x is then walking uphill.
|
| 150 |
g = float(np.linalg.norm(self._mj_model.opt.gravity))
|
| 151 |
+
# NEGATIVE x component: gravity pulls the robot BACK along -x while the
|
| 152 |
+
# walking command drives +x, so positive slope_rad means walking UPHILL.
|
| 153 |
+
# The sign was inverted first time round, which made gravity assist the command
|
| 154 |
+
# -- passive drift measured +1.02 m downhill at 17 deg, and "slope performance"
|
| 155 |
+
# improved with steepness because the robot was being pushed along.
|
| 156 |
+
tilted = np.array([-g * np.sin(slope), 0.0, -g * np.cos(slope)])
|
| 157 |
self._mj_model.opt.gravity[:] = tilted
|
| 158 |
self._mjx_model = self._mjx_model.replace(opt=self._mjx_model.opt.replace(
|
| 159 |
gravity=jnp.asarray(tilted)))
|