Skip to content

Commit 49cb4ab

Browse files
DeepMindcopybara-github
authored andcommitted
Rename time, position, and speed to times, positions, and speeds as these are lists and the time variable clashes with the imported time and causes errors.
PiperOrigin-RevId: 479538684 Change-Id: If9a47d1a4b84636435bcc980a4563ee7d2871fd1
1 parent 8ecf4a1 commit 49cb4ab

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

dm_control/mujoco/tutorial.ipynb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -511,21 +511,21 @@
511511
" point2[0], point2[1], point2[2])\n",
512512
"\n",
513513
" # traces of time, position and speed\n",
514-
"time = []\n",
515-
"position = []\n",
516-
"speed = []\n",
514+
"times = []\n",
515+
"positions = []\n",
516+
"speeds = []\n",
517517
"offset = physics.model.jnt_axis[0]/8 # offset along the joint axis\n",
518518
"\n",
519519
"def scene_callback(physics, scn):\n",
520520
" \"\"\"Draw position trace, speed modifies width and colours.\"\"\"\n",
521-
" if len(position) \u003e 1:\n",
522-
" for i in range(len(position)-1):\n",
523-
" rgba=np.array((np.clip(speed[i]/10, 0, 1),\n",
524-
" np.clip(1-speed[i]/10, 0, 1),\n",
521+
" if len(positions) \u003e 1:\n",
522+
" for i in range(len(positions)-1):\n",
523+
" rgba=np.array((np.clip(speeds[i]/10, 0, 1),\n",
524+
" np.clip(1-speeds[i]/10, 0, 1),\n",
525525
" .5, 1.))\n",
526-
" radius=.003*(1+speed[i])\n",
527-
" point1 = position[i] + offset*time[i]\n",
528-
" point2 = position[i+1] + offset*time[i+1]\n",
526+
" radius=.003*(1+speeds[i])\n",
527+
" point1 = positions[i] + offset*times[i]\n",
528+
" point2 = positions[i+1] + offset*times[i+1]\n",
529529
" add_visual_capsule(scn, point1, point2, radius, rgba)\n",
530530
"\n",
531531
"duration = 6 # (seconds)\n",
@@ -536,9 +536,9 @@
536536
"physics.reset() # Reset state and time\n",
537537
"while physics.data.time \u003c duration:\n",
538538
" # append data to the traces\n",
539-
" position.append(physics.named.data.geom_xpos[\"green_sphere\"].copy())\n",
540-
" time.append(physics.data.time)\n",
541-
" speed.append(get_geom_speed(physics, \"green_sphere\"))\n",
539+
" positions.append(physics.named.data.geom_xpos[\"green_sphere\"].copy())\n",
540+
" times.append(physics.data.time)\n",
541+
" speeds.append(get_geom_speed(physics, \"green_sphere\"))\n",
542542
" physics.step()\n",
543543
" if len(frames) \u003c physics.data.time * framerate:\n",
544544
" camera = mujoco.Camera(physics, max_geom=10000,\n",

0 commit comments

Comments
 (0)